thowe ugh, why can't I find info anywhere on using a List as an Array. My for loop can't use the List the way I want it to. 21:15
thowe I keep trying to push Perl syntax at it and it's not happening. 21:16
lizmat m: my $list := (1,2,3); my @a := $list.Array; @a[2] = 42 21:19
camelia ( no output )
thowe as simple as Array... nice lemme try 21:28
facepalm.... perfect. I'm in business 21:30
lizmat++
habere-et-disper Greetings dear gremlins. o/ 21:59
I am confused by line two:
m: say map { .succ }, 1..4;
camelia (2 3 4 5)
habere-et-disper m: say map { .succ }, 1...4
camelia ===SORRY!=== Error while compiling <tmp>
Missing comma after block argument to map
at <tmp>:1
------> say map { .succ }, 1...4<HERE><EOL>
habere-et-disper It says a comma is missing, but there is one. 22:00
librasteve one has .. (Range operator) the other has ... (Sequence operator) 22:06
Sequence operator takes a list of inputs to the left of the ..., right? 22:07
What are you trying to achieve?
habere-et-disper I realize it wants parens: 22:08
m: say map { .succ }, (1...4);
camelia (2 3 4 5)
habere-et-disper but the error message is off and the parens appear superstitious no ?
librasteve what are you trying to achieve?
eg do you want the code (map {.succ}) to be the first item in the list you give to the ... Sequence operator? 22:11
docs.raku.org/routine/%2E%2E%2E 22:13
habere-et-disper Well I was practising... find the longest substrings with no repetitions: 22:25
m: .say with max classify *.chars, map *.join, grep *.repeated.not, do given 'abracadabra' -> $w { map { $w.comb.rotor( $_ => -.pred ).Slip }, do $w.chars...1 }; # fails with $w.chars...1
and got confused by the LTA error about a comma not following the map block when it does.
camelia 4 => [brac dabr]
nahita3882 yeah the error message is LTA, but the reason it wants parantheses is because currently it's parsed as map ({ .succ }, 1...4), i.e., { .succ }, 1 ... 4 is a sequence, then it's altogether passed as 1 thing to map, and that's erroneous 22:37
>>> $_ = -1; >>> { .succ }, 1...4 (0 1 2 3 4) 22:38
(for example)
habere-et-disper That's helpful thanks. 22:40