|
This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html Set by lizmat on 8 June 2022. |
|||
|
02:11
human-blip left
02:13
human-blip joined
09:10
dakkar joined
17:35
dakkar left
19:43
snonux left
19:44
snonux joined
|
|||
| 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 | |
|
21:16
discord-raku-bot left,
discord-raku-bot joined
|
|||
| thowe | I keep trying to push Perl syntax at it and it's not happening. | 21:16 | |
|
21:16
discord-raku-bot left
21:17
discord-raku-bot joined
|
|||
| lizmat | m: my $list := (1,2,3); my @a := $list.Array; @a[2] = 42 | 21:19 | |
| camelia | ( no output ) | ||
|
21:20
discord-raku-bot left
21:21
discord-raku-bot joined
|
|||
| thowe | as simple as Array... nice lemme try | 21:28 | |
| facepalm.... perfect. I'm in business | 21:30 | ||
| lizmat++ | |||
|
21:53
habere-et-disper joined
|
|||
| 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? | ||
|
22:11
habere-et-disper left
|
|||
| eg do you want the code (map {.succ}) to be the first item in the list you give to the ... Sequence operator? | 22:11 | ||
|
22:11
habere-et-disper joined
|
|||
| 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] | ||
|
22:30
habere-et-disper left
22:34
habere-et-disper joined
|
|||
| 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 | |
|
23:05
habere-et-disper left
|
|||