listing all files in all sub directories

2009-03-10 Thread steve
I am trying to list all files in all sub-directories and have the code
below but this is listing the . directories as well as the directories
themselves. I just want the full path filenames and not the individual
directories out. Here is what I have

#!c:/Perl/bin/Perl.exe

@ARGV = qw(.) unless @ARGV;

use File::Find;

find sub { print $File::Find::name, -d && "/", "\n"}, @ARGV

for example if structure is
c:\file.txt
c:\file2.txt
c:\one\teo.txt
c:\two\text.bmp

the output of the script when run from c:\ would be
./
./script.pl
./file.txt
./file2.txt
./one/
./one/teo.txt
./two/
./two/text.bmp

all I want is
./script.pl
./file.txt
./file2.txt
./one/teo.txt
./two/text.bmp

Thanks!



Re: .map/.reduce with larger arity

2009-03-10 Thread Larry Wall
On Tue, Mar 10, 2009 at 07:46:51PM +1300, Martin D Kealey wrote:
: I'd like to be able to use grep, map, etc in a currying fashion. Can I do:
: 
:   my &square_list := -> $x { $x * $x }.map();

my &square_list := &map.assuming(-> $x { $x * $x});

: And if so, what is the signature of &square_list ?

Just (*...@list) or some such.

Larry


Re: r25775 - docs/Perl6/Spec

2009-03-10 Thread Aaron Crane
pugs-comm...@feather.perl6.nl writes:
> Modified:
>docs/Perl6/Spec/S05-regex.pod
> +The result object is available in the C object via a C<< . >> 
> lookup.

I think I understand the reasoning behind this change.

However, using . in particular says "boolean" to me.  How about
.<*> instead, with its suggestion of "whatever the Match found"?

-- 
Aaron Crane ** http://aaroncrane.co.uk/


Re: r25775 - docs/Perl6/Spec

2009-03-10 Thread Larry Wall
On Tue, Mar 10, 2009 at 11:12:13AM +, Aaron Crane wrote:
: pugs-comm...@feather.perl6.nl writes:
: > Modified:
: >docs/Perl6/Spec/S05-regex.pod
: > +The result object is available in the C object via a C<< . >> 
lookup.
: 
: I think I understand the reasoning behind this change.
: 
: However, using . in particular says "boolean" to me.  How about
: .<*> instead, with its suggestion of "whatever the Match found"?

That was our original thought (well, the first thought after .{''}),
but the problem that worried me was that if the user mistypes it as
.{*} instead of .{'*'}, it parses and silently does the wrong thing.
So the key wants to be something that doesn't parse as a term like *
(or worse, give a probabalistically delayed parse error like /).
We looked at most of the keys on the keyboard...  :)

In the end, I picked . because it looks fairly distinctive in normal
code, and kinda asks, "Well, what is it really?"  But it's not writ in
stone yet.

Larry


Re: Recursive Runtime Role Reapplication Really Rebounds

2009-03-10 Thread David Green

On 2009-Mar-9, at 3:32 am, Ovid wrote:
Since you cache resultsets if they've not changed, you could easily  
have the XML

and YAML roles getting reapplied at runtime multiple times.

Could this issue be mitigated with temp variables?
  {
 temp $resultset does Role::Serializable::YAML;
 print $resultset.as_string;
 }


I suppose, but is there a reason why you want to apply roles instead  
of coercing the results?


$x = Role::Serializable::XML $resultset;
$y = Role::Serializable::YAML $resultset;



-David



Re: .map/.reduce with larger arity

2009-03-10 Thread Daniel Ruoso
Em Seg, 2009-03-09 às 12:24 -0700, Larry Wall escreveu:
> On Mon, Mar 09, 2009 at 02:40:43PM -0300, Daniel Ruoso wrote:
> :   ... $capture ~~ $signature ...;
> :   my $args_matched = @($/).elems;
> :   &code.(|$/);
> That API still would not tell the match whether signature must match the
> entire capture (what you want for normal binding) or can stop part way
> (what you want for map and friends).

if $capture ~~ $signature :partial {
  $capture = $;
  &code.(|@($/));
}

daniel



r25797 - docs/Perl6/Spec

2009-03-10 Thread pugs-commits
Author: wayland
Date: 2009-03-11 04:10:30 +0100 (Wed, 11 Mar 2009)
New Revision: 25797

Modified:
   docs/Perl6/Spec/S06-routines.pod
Log:
Added a cross-reference to S07-iterators, as suggested by ruoso/skids on IRC.  


Modified: docs/Perl6/Spec/S06-routines.pod
===
--- docs/Perl6/Spec/S06-routines.pod2009-03-10 18:55:34 UTC (rev 25796)
+++ docs/Perl6/Spec/S06-routines.pod2009-03-11 03:10:30 UTC (rev 25797)
@@ -992,7 +992,8 @@
 in parallel with the code receiving the lists.  (Feeds, hyperops,
 and junctions all have this promise of parallelizability in common,
 but differ in interface.  Code which violates these promises is
-erroneous, and will produce undefined results when parallelized.)
+erroneous, and will produce undefined results when parallelized.
+But see also "Strict Laziness", as defined in L.)
 
 However, feeds go a bit further than ordinary lazy lists in enforcing
 the parallel discipline: they explicitly treat the blunt end as a