r25797 - docs/Perl6/Spec
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
Re: Git workflow
On Mon, Mar 9, 2009 at 11:47 PM, fREW Schmidt wrote: > Hey guys, > > I just threw together a workflow for git with rakudo ( > http://wiki.github.com/rakudo/rakudo/frews-recommended-workflow) and I > think it will help a lot. Hopefully I didn't make any mistakes. Anyway, I > plan on trying it out tomorrow (Boo Haman!) and I'd appreciate it if anyone > who knows git well will make any necesary changes. > > Thanks! > > -- > fREW Schmidt > http://blog.afoolishmanifesto.com > It's become quite obvious from these messages and from discussion on IRC (plus a personal experience) that the github pull request feature could use some help. I posted a request on githubs support page ( http://support.github.com/discussions/site/338-pull-request-comments-message-and-email) asking that comments on requests be made more obvious. Feel free to add your own thoughts to that page :-) In the meantime I am going to add some info on how to submit patches to RT to the rakudo-github wiki as it has been decided that we will do that for now. We can do both, but that seems to be a lot of work for both the submitter and pmichaud. Happy Purim! -- fREW Schmidt http://blog.afoolishmanifesto.com
Re: .map/.reduce with larger arity
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
Re: Some setting candidates
On Tue, Mar 10, 2009 at 12:46:29PM -0500, Jonathan Scott Duff wrote: > For those who are interested in adding some of the Perl 6 > builtins to Rakudo's core settings files -- I've created > a wiki page that lists some prime candidates that I think > ought to be relatively easy to convert (perhaps using inline PIR). > > Inline PIR would make the setting specific to an implemention that targets > Parrot, would it not? I thought part of the idea behind the setting was that > it be usable by other Perl 6 implementations. Is that just wishful thinking > on my part? The word "setting" here corresponds to the way it's used in the synopses -- it's the scope containing the builtin functions and methods defined by the language (possibly a domain-specific language -- for Perl 6 it's called the "core setting"). The word setting does not mean "builtin functions that are written in Perl 6". When writing the core setting files for Rakudo we're biasing towards pure Perl 6 where we can -- with the intent that these can be shared with other implementations. However, I continue to believe there will be quite a few components and operations that will always be implementation specific. That's where the inline PIR comes in for Rakudo -- we still want to use Perl 6 syntax to declare the methods and functions (because we need multimethods signatures, binding, type checking, exports, etc.), but those portions of the body that we can't yet write in Perl 6 we can at least fill in with PIR. Perhaps we need separate places in the repository for the "ready to be shared" and "not ready to be shared" components of the setting; at this early stage of development I'm thinking it's more important to organize the code by its function than by whether it's pure Perl 6 or has some inline PIR. But, if there are other implementations that would start using Rakudo's settings files today except for the existence of the inlined PIR parts, I'm willing to reorganize sooner rather than later. Regardless, I think it's important that we use the term "setting" for its synopsis meaning -- i.e., "scope corresponding to linguistic setting", and not use it to mean "a set of specific files shared by implementations". Pm
http://nopaste.snit.ch/15851
http://nopaste.snit.ch/15851
Some setting candidates
For those who are interested in adding some of the Perl 6 builtins to Rakudo's core settings files -- I've created a wiki page that lists some prime candidates that I think ought to be relatively easy to convert (perhaps using inline PIR). http://wiki.github.com/rakudo/rakudo/setting-candidates See also the file "docs/guide_to_setting.pod" in the Rakudo repository. At present I'm still heavily favoring patches submitted via RT over those submitted via the fork queue on github. Pm
[perl #63778] Rakudo doesn't numify operands to min
anyway, S03 says that "By default C and C use C semantics." I don't think that implies numification of the arguments. oh. but what happens when you cmp a Num and a List? I don't know. Neither does Parrot, which is why we get "No suitable candidate found ... " :-) pasting this addendum to the ticket.
[perl #63776] [BUG] Failed spectest
On Tue Mar 10 08:38:38 2009, nelo.ony...@googlemail.com wrote: > Hi, > > I have just updated my rakudo installation. I ran the tests and spectest. > The tests passed. Here was the summary of the spectest: > > Test Summary Report > --- > t/spec/S32-list/reduce.rakudo(Wstat: 0 > Tests: 14 Failed: 0) > TODO passed: 14 > t/spec/S32-num/complex.rakudo(Wstat: 256 > Tests: 0 Failed: 0) > Non-zero exit status: 1 > Parse errors: Bad plan. You planned 140 tests but ran 0. > Files=317, Tests=9258, 1280 wallclock secs ( 3.37 usr 3.26 sys + 1198.08 > cusr 59.64 csys = 1264.35 CPU) > Result: FAIL > Failed 1/317 test programs. 0/9258 subtests failed. > make: *** [spectest] Error 255 > > I am on Mac OS X 10.4.11 using the following version of rakudo: > > $ ./perl6 -v > This is Rakudo Perl 6, revision 37000 built on parrot 0.9.1-devel > for darwin-thread-multi-2level. > > Copyright 2006-2008, The Perl Foundation. > Now fixed in d8f59ef, thanks! Pm
Re: [perl #63764] [PATCH] Reimplement Any.reduce in Perl6
On Tue, Mar 10, 2009 at 03:40:20AM -0700, Vasily Chekalkin wrote: > +multi method reduce(Code $expression) { > +my Int $arity = $expression.count; > +die('Cannot reduce() using a unary or nullary function.') if $arity > < 2; > + > +my $list := @.list or fail('Cannot reduce() empty list'); Why is one condition 'die' and the other condition 'fail'? > +my $res = $list.shift; Note that $list might not be something that can be shifted -- 'shift' is only available for Arrays and Iterators. So, patch rejected, at least this version of it. Pm
[perl #63778] Rakudo doesn't numify operands to min
# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #63778] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=63778 > rakudo: my @a = 1,2,3; say @a min 4 rakudo 531ca2: OUTPUT«Multiple Dispatch: No suitable candidate found for 'cmp', with signature 'PP->I' [...] question is, is this a new one, or the same as the undef one? I should probably file it under the same ticket. it's not the same as the undef one I'm curious about the correct behavior there, though. pmichaud: I'd think that min numifies, so 3. * masak submits rakudobug
[perl #63776] [BUG] Failed spectest
# New Ticket Created by "Ifejinelo Onyiah" # Please include the string: [perl #63776] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=63776 > Hi, I have just updated my rakudo installation. I ran the tests and spectest. The tests passed. Here was the summary of the spectest: Test Summary Report --- t/spec/S32-list/reduce.rakudo(Wstat: 0 Tests: 14 Failed: 0) TODO passed: 14 t/spec/S32-num/complex.rakudo(Wstat: 256 Tests: 0 Failed: 0) Non-zero exit status: 1 Parse errors: Bad plan. You planned 140 tests but ran 0. Files=317, Tests=9258, 1280 wallclock secs ( 3.37 usr 3.26 sys + 1198.08 cusr 59.64 csys = 1264.35 CPU) Result: FAIL Failed 1/317 test programs. 0/9258 subtests failed. make: *** [spectest] Error 255 I am on Mac OS X 10.4.11 using the following version of rakudo: $ ./perl6 -v This is Rakudo Perl 6, revision 37000 built on parrot 0.9.1-devel for darwin-thread-multi-2level. Copyright 2006-2008, The Perl Foundation. -- Nelo Onyiah
Re: Recursive Runtime Role Reapplication Really Rebounds
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: r25775 - docs/Perl6/Spec
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
never mind, found it
Synopsis 6 has arity arity vs count for manditory vs optional parameters sorry for the noise
Is "arity" described in a synopsis?
I've browsed the discussions on re-implementing reduce in perl6, and saw the comment how "arity" returns the # of required arguments. I wanted to refer back to a discussion of arity in the synopsis, looking to see if there was a way to get the # of optional args, but grepping through the directory in the pugs repository didn't help me. Can someone point me to the docs for "arity"?
Re: Git workflow
On Tue, Mar 10, 2009 at 09:02:08AM -0500, Jonathan Scott Duff wrote: > On Tue, Mar 10, 2009 at 08:40:12AM -, Rafael Garcia-Suarez wrote: > > Moritz Lenz wrote in perl.perl6.compiler : > > > Hi, > > > > > > fREW Schmidt wrote: > > >> I just threw together a workflow for git with rakudo ( > > >> http://wiki.github.com/rakudo/rakudo/frews-recommended-workflow) and I > > >> think > > >> it will help a lot. Hopefully I didn't make any mistakes. Anyway, I > > >> plan > > >> on trying it out tomorrow (Boo Haman!) and I'd appreciate it if anyone > > >> who > > >> knows git well will make any necesary changes. > > > > > > When you did more than one commit in the branch, please merge with the > > > ---squash option, so that our dear pumpking only has to review one > > > patch, not multiple. > > > > As someone who reviews patches quite often, my advice would be exactly > > the contrary -- I tend to prefer a series of small patches with long > > commit messages: that way it's easier to review the logic of the whole > > change. (Personal taste only.) Our initial attempts in this regard didn't work well -- submissions would contain individual commits that contained lots of false starts and backtracks, making it hard to see the result. > When you're committing false starts and partial implementations, you > should use rebase -i and squash those commits into a single > complete-feature commit (and thus a single patch). > > If, ultimately, the subject of your branch has several pieces or takes > several steps to fully implement, each of those steps should be a > commit of their own. Exactly. Pm
[perl #63772] Rakudo can't bind an array element to an array
# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #63772] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=63772 > perl6: my @a = 1,2,3; @a[2] := []; say @a.perl elf 25787: OUTPUT«[1,2,3]» ..rakudo 95ce39: OUTPUT«rtype not set [...] ..pugs: OUTPUT«\(1, 2, ())» * masak submits rakudobug Modulo the exact syntax, I'd expect the answer from Rakudo to be more like the one from Pugs.
[perl #63770] Rakudo does the Wrong Thing when calling a method which returns a closure
$.a.() is equivalent to $.a().() which is equivalent to $.a()() ruoso: ok. I buy that. I just don't see why .() and () aren't equivalent in this particular case. they are but you're missing that $.a is a method call not a variable ah. so, the full version of $.a is $.a() * masak sees now then $.a()() and $.a().() are the same ruoso: thank you for your patience with me. masak, so, for the rakudobug "rakudo is making an exception in the parse of $.a when the class defines "has $.a"" and it shouldn't thanks. :) pasted.
[perl #63770] Rakudo does the Wrong Thing when calling a method which returns a closure
# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #63770] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=63770 > hmm something's wrong there rakudo: class A { method a { { .say } }; method foo { $.a(1); $.a.(2) } }; my $a = A.new; $a.foo rakudo 95ce39: OUTPUT«Use of uninitialized valueinvoke() not implemented in class 'Integer [...] there it is... rakudo is making something wrong what just happened? :) uhm how can that even dispatch? rakudo is probably assuming something because of "has $.a" method a { { .say } } that's supposed to return a closure, right? yes * masak submits rakudobug $.a(1) sends (1) as argument to method a $.a.(1) expects the return of a to be a callable, and then send 1 as an argument to that * SamB pretends not to understand the difference ;-P masak, and btw... there is *always* a method involved ruoso: no, $.a.(1) is the same as $.a(1) unless you use $!a ruoso: right. masak, so, if method a accepts an argument, how do you send it? ruoso: you're assuming that $.a.(1) makes two calls, one to a and one to its returned closure. I don't see why you assume that. because of the two dots ruoso: but .() and () are equivalent, no? unless where they are not :-) masak: isn't that what the entire discussion has been about ? SamB: yes. we're starting in on the second lap round the circle now. masak, .() and () are equivalent when you're dealing with variables I think it would DWIM to make $.a.() being the same as $.a().a() $foo() and $foo.() are the same but I have no idea if it's specced that way * masak gives up we're evidently on uncharted territory here I'm pasting this whole discussion into the rakudobug
Re: Git workflow
On Tue, Mar 10, 2009 at 08:40:12AM -, Rafael Garcia-Suarez wrote: > Moritz Lenz wrote in perl.perl6.compiler : > > Hi, > > > > fREW Schmidt wrote: > >> I just threw together a workflow for git with rakudo ( > >> http://wiki.github.com/rakudo/rakudo/frews-recommended-workflow) and I > >> think > >> it will help a lot. Hopefully I didn't make any mistakes. Anyway, I plan > >> on trying it out tomorrow (Boo Haman!) and I'd appreciate it if anyone who > >> knows git well will make any necesary changes. > > > > When you did more than one commit in the branch, please merge with the > > ---squash option, so that our dear pumpking only has to review one > > patch, not multiple. > > As someone who reviews patches quite often, my advice would be exactly > the contrary -- I tend to prefer a series of small patches with long > commit messages: that way it's easier to review the logic of the whole > change. (Personal taste only.) I think you should do both! :-) When you're committing false starts and partial implementations, you should use rebase -i and squash those commits into a single complete-feature commit (and thus a single patch). If, ultimately, the subject of your branch has several pieces or takes several steps to fully implement, each of those steps should be a commit of their own. Thus our pumpking will see a series of commits that could each probably stand on their own (though there may be some dependency ordering). And there shouldn't be any spurious or throw-away commit messages like "Oops, forgot to twiddle the frobnitz in the previous commit" Just my humble opinion, -Scott -- Jonathan Scott Duff d...@lighthouse.tamucc.edu
[perl #63764] [PATCH] Reimplement Any.reduce in Perl6
# New Ticket Created by Vasily Chekalkin # Please include the string: [perl #63764] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=63764 > --- src/builtins/any-list.pir | 61 - src/setting/Any-list.pm | 21 ++- 2 files changed, 20 insertions(+), 62 deletions(-) diff --git a/src/builtins/any-list.pir b/src/builtins/any-list.pir index a61edd5..6540465 100644 --- a/src/builtins/any-list.pir +++ b/src/builtins/any-list.pir @@ -296,67 +296,6 @@ Return a List with the keys of the invocant. .tailcall self.'pick'($I0) .end -=item reduce(...) - -=cut - -.namespace [] -.sub 'reduce' :multi('Sub') -.param pmc expression -.param pmc values :slurpy -.tailcall values.'reduce'(expression) -.end - -.namespace ['Any'] -.sub 'reduce' :method :multi(_, 'Sub') -.param pmc expression -.local pmc retv -.local pmc iter -.local pmc elem -.local pmc args -.local int i, arity - -arity = expression.'arity'() -if arity < 2 goto error - -iter = self.'iterator'() -unless iter goto empty -retv = shift iter - loop: -unless iter goto done - -# Create arguments for closure -args = new 'ResizablePMCArray' -# Start with 1. First argument is result of previous call -i = 1 - - args_loop: -if i == arity goto invoke -unless iter goto elem_undef -elem = shift iter -goto push_elem - elem_undef: -elem = 'undef'() - - push_elem: -push args, elem -inc i -goto args_loop - - invoke: -retv = expression(retv, args :flat) -goto loop - - empty: -.tailcall '!FAIL'('Cannot reduce an empty list') - - error: -'die'('Cannot reduce() using a unary or nullary function.') - - done: -.return(retv) -.end - =item sort() diff --git a/src/setting/Any-list.pm b/src/setting/Any-list.pm index 9af5a33..5cb7ed6 100644 --- a/src/setting/Any-list.pm +++ b/src/setting/Any-list.pm @@ -3,7 +3,22 @@ class Any is also { gather { take $_ if $test($_) for $values.list; } -} +}; + +multi method reduce(Code $expression) { +my Int $arity = $expression.count; +die('Cannot reduce() using a unary or nullary function.') if $arity < 2; + +my $list := @.list or fail('Cannot reduce() empty list'); + +my $res = $list.shift; +while $list { +my @args = gather { take $list.shift if $list for 2..$arity }; +$res = &$expression($res, |@args); +} + +$res; +}; our List multi method map(Code *&expr) { return gather { @@ -52,6 +67,10 @@ our List multi grep(Code $test, *...@values) { @values.grep($test) } +multi reduce ( Code $expression ;; *...@values ) { +@values.reduce($expression); +} + our List multi map(Code $expr, *...@values) { @values.map($expr) } -- 1.6.2.rc0
perl6-all@perl.org
# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #63766] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=63766 > rakudo: &map.assuming({}) rakudo 95ce39: OUTPUT«Null PMC access in find_method() [...] * masak submits rakudobug rakudo: &map.assuming({}); say "alive" rakudo 95ce39: OUTPUT«Null PMC access in find_method() [...] aye, that's more informative.
[perl #63762] Slightly better implementation of Any.reduce
# New Ticket Created by Vasily Chekalkin # Please include the string: [perl #63762] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=63762 > After some discussions on #perl6 I've created new version of Any.reduce. pmichaud++ as usual :) -- Bacek
[perl #63760] Rakudo thinks there is an implied semicolon after loop { ... }
# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #63760] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=63760 > rakudo: loop { say "OH HAI"; last } while 1 rakudo 95ce39: OUTPUT«OH HAI [...] moritz_: why does it do that? I thinks that the statement is ended after the } then tries to parse the while as a loop fails then parses it as a sub call moritz_: that's just wrong. it is. * masak submits rakudobug
Re: Git workflow
Moritz Lenz wrote in perl.perl6.compiler : > Hi, > > fREW Schmidt wrote: >> I just threw together a workflow for git with rakudo ( >> http://wiki.github.com/rakudo/rakudo/frews-recommended-workflow) and I think >> it will help a lot. Hopefully I didn't make any mistakes. Anyway, I plan >> on trying it out tomorrow (Boo Haman!) and I'd appreciate it if anyone who >> knows git well will make any necesary changes. > > When you did more than one commit in the branch, please merge with the > ---squash option, so that our dear pumpking only has to review one > patch, not multiple. As someone who reviews patches quite often, my advice would be exactly the contrary -- I tend to prefer a series of small patches with long commit messages: that way it's easier to review the logic of the whole change. (Personal taste only.) -- It is official: perl people are crazy. -- Linus Torvalds on the git mailing list
[perl #63698] [PATCH] Reimplement List.reduce in Perl6.
Hello. This one is latest vesion. Sorry for messing with git-send-email :-/ -- Bacek
Re: r25775 - docs/Perl6/Spec
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: .map/.reduce with larger arity
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: Git workflow
Uhm, ignore me, it seems I can't read, it's already in there. Sorry for the noise. Moritz Moritz Lenz wrote: > Hi, > > fREW Schmidt wrote: >> I just threw together a workflow for git with rakudo ( >> http://wiki.github.com/rakudo/rakudo/frews-recommended-workflow) and I think >> it will help a lot. Hopefully I didn't make any mistakes. Anyway, I plan >> on trying it out tomorrow (Boo Haman!) and I'd appreciate it if anyone who >> knows git well will make any necesary changes. > > When you did more than one commit in the branch, please merge with the > ---squash option, so that our dear pumpking only has to review one > patch, not multiple. > > Cheers, > Moritz >
listing all files in all sub directories
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: Git workflow
Hi, fREW Schmidt wrote: > I just threw together a workflow for git with rakudo ( > http://wiki.github.com/rakudo/rakudo/frews-recommended-workflow) and I think > it will help a lot. Hopefully I didn't make any mistakes. Anyway, I plan > on trying it out tomorrow (Boo Haman!) and I'd appreciate it if anyone who > knows git well will make any necesary changes. When you did more than one commit in the branch, please merge with the ---squash option, so that our dear pumpking only has to review one patch, not multiple. Cheers, Moritz