| librasteve | okaaay … I guess I can understand that we don’t want ’list` to break laziness by reifying a Seq unnecessarily… guess I can take a look at the source and make a docs PR | 06:42 | |
| lizmat | m: dd eager (1,2.3).Seq | 06:48 | |
| camelia | (1, 2.3) | ||
| lizmat | *that* will make it a List | ||
| (reified List) | |||
| m: dd eager (1,2.3).Seq.List | |||
| camelia | (1, 2.3) | ||
| lizmat | see, no difference, yet the List from *that* is not reified, as we've found out recently | 06:49 | |
| m: use nqp; dd nqp::getattr((1,2,3).Seq.List,List,q/$!reified/) | 06:50 | ||
| camelia | ().IterationBuffer | ||
| lizmat | m: use nqp; dd nqp::getattr(eager((1,2,3).Seq),List,q/$!reified/) | 06:51 | |
| camelia | ===SORRY!=== Error while compiling <tmp> Undeclared routine: eager used at line 1 |
||
| lizmat | m: use nqp; dd nqp::getattr((eager(1,2,3).Seq),List,q/$!reified/) | ||
| camelia | ===SORRY!=== Error while compiling <tmp> Undeclared routine: eager used at line 1 |
||
| lizmat | m: use nqp; dd nqp::getattr((eager (1,2,3).Seq),List,q/$!reified/) | ||
| camelia | (1, 2, 3).IterationBuffer | ||
|
07:46
librasteve_ joined
07:53
dakkar joined
07:54
dakkar left
07:55
dakkar joined
|
|||
| librasteve | lizmat: thanks for clarifying - as is often the case, fielding questions here means I learn new things - mainly by forcing me to review the docs and re-up my knowledge | 08:17 | |
| @timemelon - thanks for your patience on this - on this one, I (re)discovered that close reading of this docs page docs.raku.org/language/list clarifies matters | 08:19 | ||
| this "told" me two things (i) you can store lazy sequences in Lists and Arrays and (ii) Although the Seq class does provide some positional subscripting, it does not provide the full interface of Positional, so an @-sigiled variable may not be bound to a Seq, and trying to do so will yield an error. This is because the Seq does not keep values around after you have used them. This is useful behavior if you have a | 08:21 | ||
| very long sequence, as you may want to throw values away after using them, so that your program does not fill up memory. | |||
| lizmat | Seq positional feature is done by the PositionalBindFailover logic | 08:22 | |
| librasteve | yeah, this docs sections also say It is possible to hide a Seq inside a List, which will still be lazy, but will remember old values. This is done by calling the .list method. Since this List fully supports Positional, you may bind it directly to an @-sigiled variable. | 08:24 | |
| sooo - I think that we also need to restate this in the other docs page on routine list to cover that use-case | 08:25 | ||
| PR coming | |||
| librasteve_ | oh - wait | 08:46 | |
| I just tested the example at the end of this section docs.raku.org/language/list#Sequences | 08:47 | ||
| oh - issue was that the example does work in the Raku REPL (I guess since that calls say on each line of results) - all is good if in an actual script | 08:49 | ||
| s/does/does not/ | |||
| m: my @s := (loop { 42.say }).list; say @s[2], ‘:’, @s[1], ‘:’ @s[4]; | 08:50 | ||
| camelia | ===SORRY!=== Error while compiling <tmp> Two terms in a row at <tmp>:1 ------> .say }).list; say @s[2], ‘:’, @s[1], ‘:’<HERE> @s[4]; expecting any of: infix infix stopper postfix statement en… |
||
| librasteve_ | m: my @s := (loop { 42.say }).list; say @s[2]; say @s[1]; say @s[4]; | 08:51 | |
| camelia | 42 42 42 True True 42 42 True |
||
| librasteve_ | well - works fine in an actual Raku script - guess Camelia struggles too | 08:52 | |
| oh, I am holding it wrong (the ‘say’ is on the loop) durr | 08:54 | ||
| m: my @s := (loop { 42.say }).list; @s[2]; @s[1]; @s[4]; | |||
| camelia | 42 42 42 42 42 |
||
|
12:39
human-blip left
12:40
human-blip joined
|
|||
| librasteve_ | rakudoweekly.blog/2026/06/29/2026-...lease-194/ | 13:51 | |
| lizmat | librasteve__++ | 14:03 | |
|
16:34
dakkar left
17:07
swaggboi joined
20:19
swaggboi left
20:21
swaggboi joined
22:38
apogee_ntv left,
apogee_ntv joined
|
|||