Re: Chained sequence operators

2018-01-26 Thread ToddAndMargo
On 01/26/2018 01:51 PM, Brandon Allbery wrote: You probably want an enum to get that behavior. Strings are strings; Perl has no idea what they mean. Larry is a cleaver guy, so I was pushing the envelope! :-)

Re: Chained sequence operators

2018-01-26 Thread Brandon Allbery
You probably want an enum to get that behavior. Strings are strings; Perl has no idea what they mean. On Fri, Jan 26, 2018 at 4:45 PM, ToddAndMargo wrote: > Sweet! > $ perl6 -e 'my $x=(1...5...1); say $x;' > (1 2 3 4 5 4 3 2 1) > > Characters too! > $ perl6 -e 'my

Re: Chained sequence operators

2018-01-26 Thread ToddAndMargo
Sweet! $ perl6 -e 'my $x=(1...5...1); say $x;' (1 2 3 4 5 4 3 2 1) Characters too! $ perl6 -e 'my $x=("a"..."f"..."a"); say $x;' (a b c d e f e d c b a) Ah Shucks (ah poop)! $ perl6 -e 'my $x=("Monday"..."Friday"); say $x;' (Monday Momday Molday Mokday Mojday Moiday Mpnday Mpmday Mplday

Re: Chained sequence operators

2018-01-26 Thread Larry Wall
The most detailed description of ... is still to be found starting down a few paragraphs in the https://design.perl6.org/S03.html#List_infix_precedence section. In general the operators have not suffered as much "spec rot" as some other parts of the "speculations" known as Synopses, so most of

Chained sequence operators

2018-01-26 Thread Sean McAfee
Today I stumbled across the fact that the sequence operator can be chained: > 1...5...1 (1 2 3 4 5 4 3 2 1) You can even reduce with it: > [...] 1, 5, 3, 10, 8 (1 2 3 4 5 4 3 4 5 6 7 8 9 10 9 8) And even sequences with custom generators can be joined: > 0,1,*+*...144,*/2...9 (0 1 1 2 3 5 8 13

[perl #132172] [BUG] `orelse` + block in a string gets the wrong $_

2018-01-26 Thread Zoffix Znet via RT
On Wed, 27 Sep 2017 07:09:16 -0700, c...@zoffix.com wrote: > Here, instead of the Failure, the $_ is an Any: > > 13:59 m: sub x { my $ver = .lines.uc with "blazr".IO.open > orelse note "meow {.exception.message}" and return 42; "meow$ver" }; > dd x > 13:59 camelia rakudo-moar

[perl #126984] [BUG] WhateverCode in given doesn't get refreshed when entering surrounding block in Rakudo

2018-01-26 Thread Zoffix Znet via RT
On Mon, 21 Dec 2015 13:33:51 -0800, masak wrote: > m: sub foo($x) { say (* == $x)($_) given $x }; foo(1); foo(2) > rakudo-moar cfb1f3: OUTPUT«True␤False␤» > * masak submits rakudobug > > Examining the expression printed, it basically says "$x should be > numerically equal to itself" in a

[perl #126984] [BUG] WhateverCode in given doesn't get refreshed when entering surrounding block in Rakudo

2018-01-26 Thread Zoffix Znet via RT
On Mon, 21 Dec 2015 13:33:51 -0800, masak wrote: > m: sub foo($x) { say (* == $x)($_) given $x }; foo(1); foo(2) > rakudo-moar cfb1f3: OUTPUT«True␤False␤» > * masak submits rakudobug > > Examining the expression printed, it basically says "$x should be > numerically equal to itself" in a

[perl #128054] [PARSER] In a string enclosed in parens, a {}-interpolation can't access the topic $_ of a statement modifier

2018-01-26 Thread Zoffix Znet via RT
On Tue, 03 Oct 2017 09:38:23 -0700, b...@abrij.org wrote: > On Mon, 02 Oct 2017 19:08:27 -0700, alex.jakime...@gmail.com wrote: > > Also worth taking a look at > > https://rt.perl.org/Ticket/Display.html?id=126569 > > > > On 2017-09-29 14:06:58, b...@abrij.org wrote: > > > On Sun, 28 May 2017

[perl #132172] [BUG] `orelse` + block in a string gets the wrong $_

2018-01-26 Thread Zoffix Znet via RT
On Wed, 27 Sep 2017 07:09:16 -0700, c...@zoffix.com wrote: > Here, instead of the Failure, the $_ is an Any: > > 13:59 m: sub x { my $ver = .lines.uc with "blazr".IO.open > orelse note "meow {.exception.message}" and return 42; "meow$ver" }; > dd x > 13:59 camelia rakudo-moar

[perl #126413] [BUG] WhateverCode loses topic inside given modifier

2018-01-26 Thread Zoffix Znet via RT
On Tue, 20 Oct 2015 18:11:22 -0700, larry wrote: > This works: > > > p6 'given 10 { say (* + $_)(32) }' > 42 > > but this doesn't: > > > p6 'say (* + $_)(32) given 10' > Use of uninitialized value of type Any in numeric context in whatevercode > at -e:1 > 32 Thank you for the report. This is

[perl #126413] [BUG] WhateverCode loses topic inside given modifier

2018-01-26 Thread Zoffix Znet via RT
On Tue, 20 Oct 2015 18:11:22 -0700, larry wrote: > This works: > > > p6 'given 10 { say (* + $_)(32) }' > 42 > > but this doesn't: > > > p6 'say (* + $_)(32) given 10' > Use of uninitialized value of type Any in numeric context in whatevercode > at -e:1 > 32 Thank you for the report. This is

[perl #128054] [PARSER] In a string enclosed in parens, a {}-interpolation can't access the topic $_ of a statement modifier

2018-01-26 Thread Zoffix Znet via RT
On Tue, 03 Oct 2017 09:38:23 -0700, b...@abrij.org wrote: > On Mon, 02 Oct 2017 19:08:27 -0700, alex.jakime...@gmail.com wrote: > > Also worth taking a look at > > https://rt.perl.org/Ticket/Display.html?id=126569 > > > > On 2017-09-29 14:06:58, b...@abrij.org wrote: > > > On Sun, 28 May 2017

[perl #132211] [BUG] combination of `andthen` and `orelse` causes closed over variable to never update

2018-01-26 Thread Zoffix Znet via RT
On Tue, 03 Oct 2017 08:07:41 -0700, c...@zoffix.com wrote: > IRC: https://irclog.perlgeek.de/perl6/2017-10-03#i_15250878 > > Reads "aaa", not "abc": > 15:05 Zoffix m: for { $^v.uc andthen say $v orelse .say } > 15:05 camelia rakudo-moar f946bd: OUTPUT: «a␤a␤a␤» > >

[perl #126569] [BUG] xx-repeated expression enclosed in parens can't access the topic $_ of a statement modifier

2018-01-26 Thread Zoffix Znet via RT
On Thu, 05 Nov 2015 01:58:17 -0800, sml...@gmail.com wrote: > This works: > > ➜ .pick xx 10 given 1..6 > (6 3 1 1 5 1 6 3 4 2) > > But putting parens around the xx operation, breaks it: > > ➜ (.pick xx 10) given 1..6 > ((Any) (Any) (Any) (Any) (Any) (Any) (Any) (Any) (Any) (Any)) > > The

[perl #131548] [BUG] andthen weirdness with lexicals

2018-01-26 Thread Zoffix Znet via RT
On Fri, 09 Jun 2017 12:48:55 -0700, c...@cpan.org wrote: > Example code: > > $ cat bug.p6 > for ^7 { > my $x = 1; > 1 andthen print "$x " > andthen $x = 2 > andthen $x = 3 > andthen $x = 4; > } > > Output: > > $ perl6 bug.p6 > 1 4 3 3 3 3 3 > > We apparently create a

[perl #130575] [BUG] Variables inside a try {} block used with `andthen` don't always get updated to correct values

2018-01-26 Thread Zoffix Znet via RT
On Tue, 17 Jan 2017 10:04:11 -0800, c...@zoffix.com wrote: > m: sub itcavuc ($c) { (try say $c) andthen 42 }; itcavuc $_ > for 2, 4, 6 > rakudo-moar 7d5bbe: OUTPUT«2␤4␤6␤» > m: sub itcavuc ($c) { try {say $c} andthen 42 }; itcavuc $_ > for 2, 4, 6 > rakudo-moar 7d5bbe: OUTPUT«2␤2␤4␤» > > The

[perl #130575] [BUG] Variables inside a try {} block used with `andthen` don't always get updated to correct values

2018-01-26 Thread Zoffix Znet via RT
On Tue, 17 Jan 2017 10:04:11 -0800, c...@zoffix.com wrote: > m: sub itcavuc ($c) { (try say $c) andthen 42 }; itcavuc $_ > for 2, 4, 6 > rakudo-moar 7d5bbe: OUTPUT«2␤4␤6␤» > m: sub itcavuc ($c) { try {say $c} andthen 42 }; itcavuc $_ > for 2, 4, 6 > rakudo-moar 7d5bbe: OUTPUT«2␤2␤4␤» > > The

[perl #132211] [BUG] combination of `andthen` and `orelse` causes closed over variable to never update

2018-01-26 Thread Zoffix Znet via RT
On Tue, 03 Oct 2017 08:07:41 -0700, c...@zoffix.com wrote: > IRC: https://irclog.perlgeek.de/perl6/2017-10-03#i_15250878 > > Reads "aaa", not "abc": > 15:05 Zoffix m: for { $^v.uc andthen say $v orelse .say } > 15:05 camelia rakudo-moar f946bd: OUTPUT: «a␤a␤a␤» > >

[perl #132337] [BUG] Code block inside `andthen`/`orelse` doesn't close over lexical variables correctly

2018-01-26 Thread Zoffix Znet via RT
On Sat, 21 Oct 2017 06:23:40 -0700, sml...@gmail.com wrote: > Golfed example: > > sub foo ($str) { > { say $str }() orelse Nil > } > > foo "aa"; # aa > foo "bb"; # aa > > The second call should print "bb", not "aa". > > Replacing the `say` with `return`, throws

[perl #132337] [BUG] Code block inside `andthen`/`orelse` doesn't close over lexical variables correctly

2018-01-26 Thread Zoffix Znet via RT
On Sat, 21 Oct 2017 06:23:40 -0700, sml...@gmail.com wrote: > Golfed example: > > sub foo ($str) { > { say $str }() orelse Nil > } > > foo "aa"; # aa > foo "bb"; # aa > > The second call should print "bb", not "aa". > > Replacing the `say` with `return`, throws

[perl #131548] [BUG] andthen weirdness with lexicals

2018-01-26 Thread Zoffix Znet via RT
On Fri, 09 Jun 2017 12:48:55 -0700, c...@cpan.org wrote: > Example code: > > $ cat bug.p6 > for ^7 { > my $x = 1; > 1 andthen print "$x " > andthen $x = 2 > andthen $x = 3 > andthen $x = 4; > } > > Output: > > $ perl6 bug.p6 > 1 4 3 3 3 3 3 > > We apparently create a

[perl #126569] [BUG] xx-repeated expression enclosed in parens can't access the topic $_ of a statement modifier

2018-01-26 Thread Zoffix Znet via RT
On Thu, 05 Nov 2015 01:58:17 -0800, sml...@gmail.com wrote: > This works: > > ➜ .pick xx 10 given 1..6 > (6 3 1 1 5 1 6 3 4 2) > > But putting parens around the xx operation, breaks it: > > ➜ (.pick xx 10) given 1..6 > ((Any) (Any) (Any) (Any) (Any) (Any) (Any) (Any) (Any) (Any)) > > The