Re: $*CWD and chdir()
Martin D Kealey wrote: I wonder if this is becoming the new Perl mantra use lexically scoped pragmata. Larry said it much more succinctly: all's fair if you predeclare. -- Jonathan Dataweaver Lang
Re: patch for t/spec/s06-multi/type-based.t
On Fri, 2009-08-21 at 14:24 +1100, Илья wrote: -multi foo (@bar) { Array ~ join(', ', @bar) } -multi foo (%bar) { Hash ~ join(', ', %bar.keys.sort) } +multi foo (@bar) { Positioanl ~ join(', ', @bar) } +multi foo (%bar) { Associative ~ join(', ', %bar.keys.sort) } Typo in third line there (Positioanl ). -'f
r28043 - docs/Perl6/Spec
Author: moritz Date: 2009-08-21 12:49:04 +0200 (Fri, 21 Aug 2009) New Revision: 28043 Modified: docs/Perl6/Spec/S02-bits.pod Log: [S02] small clarifications on Whatever comprehensions Modified: docs/Perl6/Spec/S02-bits.pod === --- docs/Perl6/Spec/S02-bits.pod2009-08-20 17:45:03 UTC (rev 28042) +++ docs/Perl6/Spec/S02-bits.pod2009-08-21 10:49:04 UTC (rev 28043) @@ -827,7 +827,7 @@ * - 1 -produces a function of a single argument: +produces a closure of a single argument: { $_ - 1 } @@ -836,13 +836,18 @@ @primes = grep *.prime, 2..*; +If multiple C* appear as terms within a single expression, the resulting +closure binds them all to the same argument, so C* * * translates to +C{ $_ * $_ }. + These closures are of type CCode:($), not CWhatever, so that constructs can distinguish via multiple dispatch: 1,2,3 ... * 1,2,3 ... *+1 -The bare C* form may also be called as a function, and represents the identify function: +A bare C* which is immediately followed by a C(...) or C.(...) is parsed +as the unary identity closure: *(42) == 42 (* + 1)(42) == 43
r28045 - docs/Perl6/Spec
Author: wayland Date: 2009-08-21 14:11:17 +0200 (Fri, 21 Aug 2009) New Revision: 28045 Modified: docs/Perl6/Spec/S02-bits.pod docs/Perl6/Spec/S03-operators.pod docs/Perl6/Spec/S09-data.pod docs/Perl6/Spec/S11-modules.pod Log: [S02,S03,S09,S11] Changed any example that had the animal Cat to have Squirrel instead (both have kittens), because we already have a type called Cat and a method called cat, and I could see some potential for confusion. Modified: docs/Perl6/Spec/S02-bits.pod === --- docs/Perl6/Spec/S02-bits.pod2009-08-21 11:17:35 UTC (rev 28044) +++ docs/Perl6/Spec/S02-bits.pod2009-08-21 12:11:17 UTC (rev 28045) @@ -1245,9 +1245,9 @@ types to act like an and junction: # Anything assigned to the variable $mitsy must conform -# to the type Fish and either the Cat or Dog type... -my Cat|Dog Fish $mitsy = new Fish but { Bool.pick ?? .does Cat - !! .does Dog }; +# to the type Fish and either the Squirrel or Dog type... +my Squirrel|Dog Fish $mitsy = new Fish but { Bool.pick ?? .does Squirrel + !! .does Dog }; [Note: the above is a slight lie, insofar as parameters are currently restricted for 6.0.0 to having only a single main type for the @@ -1662,7 +1662,7 @@ the (untyped) variable names yourself via an additional signature in parentheses: -sub foo (Num Dog|Cat $numdog, MySig $a ($i,$j,$k,$mousestatus)) {...} +sub foo (Num Dog|Squirrel $numdog, MySig $a ($i,$j,$k,$mousestatus)) {...} foo($mynumdog, \(1, 2.7182818, 1.0i, statmouse()); =item * Modified: docs/Perl6/Spec/S03-operators.pod === --- docs/Perl6/Spec/S03-operators.pod 2009-08-21 11:17:35 UTC (rev 28044) +++ docs/Perl6/Spec/S03-operators.pod 2009-08-21 12:11:17 UTC (rev 28045) @@ -4368,7 +4368,7 @@ %monsters.{'cookie'} = Monster.new; %beatles\.{'ringo'} = Beatle.new; %people\ .{'john'} = Person.new; - %cats\ .{'fluffy'} = Cat.new; + %cats\ .{'fluffy'} = Squirrel.new; Whitespace is in general required between any keyword and any opening bracket that is Inot introducing a subscript or function arguments. Modified: docs/Perl6/Spec/S09-data.pod === --- docs/Perl6/Spec/S09-data.pod2009-08-21 11:17:35 UTC (rev 28044) +++ docs/Perl6/Spec/S09-data.pod2009-08-21 12:11:17 UTC (rev 28045) @@ -1186,7 +1186,7 @@ You can limit the keys to objects of particular types: -my Fight %hash{Dog; Cat where {!.scared}}; +my Fight %hash{Dog; Squirrel where {!.scared}}; The standard Hash is just Modified: docs/Perl6/Spec/S11-modules.pod === --- docs/Perl6/Spec/S11-modules.pod 2009-08-21 11:17:35 UTC (rev 28044) +++ docs/Perl6/Spec/S11-modules.pod 2009-08-21 12:11:17 UTC (rev 28045) @@ -321,7 +321,7 @@ When at the top of a file you say something like -module Cat; +module Squirrel; or
r28046 - docs/Perl6/Spec
Author: moritz Date: 2009-08-21 14:18:14 +0200 (Fri, 21 Aug 2009) New Revision: 28046 Modified: docs/Perl6/Spec/S03-operators.pod Log: [S03] store Squirrels in %squirrels, not in %cats Modified: docs/Perl6/Spec/S03-operators.pod === --- docs/Perl6/Spec/S03-operators.pod 2009-08-21 12:11:17 UTC (rev 28045) +++ docs/Perl6/Spec/S03-operators.pod 2009-08-21 12:18:14 UTC (rev 28046) @@ -4365,10 +4365,10 @@ It is, however, still possible to align subscripts and other postfix operators by explicitly using the Iunspace syntax (see S02): + %squirrels{'fluffy'} = Squirrel.new; %monsters.{'cookie'} = Monster.new; %beatles\.{'ringo'} = Beatle.new; %people\ .{'john'} = Person.new; - %cats\ .{'fluffy'} = Squirrel.new; Whitespace is in general required between any keyword and any opening bracket that is Inot introducing a subscript or function arguments.
Re: [perl #64566] @a[1..*] adds trailing undef value
On Wed, Aug 19, 2009 at 04:54:10AM -0700, Moritz Lenz via RT wrote: On Wed Apr 08 14:59:19 2009, moritz wrote: 23:55 @moritz_ rakudo: my @a = 1..4; say @a[1..*].perl 23:56 p6eval rakudo 6b9755: OUTPUT«[2, 3, 4, undef]» It should just be [2, 3, 4]. Since the discussion came up on #perl6 if this is really the expected behaviour, S09 says: As the end-point of a range, a lone whatever means to the maximum specified index (if fixed indices were defined): say @calendar[5..*]; # Same as: say @calendar[5..11] say @calendar{Jun..*};# Same as: say @calendar{Jun..Dec} or to the largest allocated index (if there are no fixed indices): say @data[1..*]; # Same as: say @results[1..5] It doesn't mention how the postcifcumfix:[ ] is supposed to introspect those to find out if the WhateverCode object constructed by 1..* needs to receive self.elems or self.elems-1 as an argument. The short answer is that 1..* isn't a WhateverCode object, it's a Range with a Whatever endpoint. (Rakudo currently gets this wrong, yes.) So postcircumfix:[ ] then changes its dispatch based on having a Range argument. Pm