| 3 Nov 2025 | |||
| librasteve_ | rakudoweekly.blog/2025/11/03/2025-...drey-tang/ | 18:52 | |
| habere-et-disper | m: say '~'.IO.absolute | 23:57 | |
| camelia | /home/camelia/~ | ||
| habere-et-disper | It looks like the tilde doesn't get removed? Is this correct? | ||
| 4 Nov 2025 | |||
| lizmat | yes, that's a unixism, so not supported out of the box in Raku | 00:03 | |
| habere-et-disper | =b | 00:10 | |
| m: say ( shell 'echo -n ~', :out ).out.slurp( :close ) | 00:14 | ||
| camelia | /home/camelia | ||
| jubilatious1_98524 | m: say "~", $*CWD.absolute; | 03:19 | |
| Raku eval | ~/home/glot | ||
| jubilatious1_98524 | m: say $*CWD.absolute; | 03:20 | |
| Raku eval | /home/glot | ||
| ab5tract | m: dd %*ENV<HHOME> | 07:07 | |
| camelia | element{'HHOME'} = Any | ||
| ab5tract | m: dd %*ENV<HOME> | ||
| camelia | "/home/camelia" | ||
| ab5tract | this would be the usual way to do it | 07:08 | |
| jubilatious1_98524 | m: say "~", %*ENV<HOME>; | 14:34 | |
| Raku eval | ~/home/glot | ||
| jubilatious1_98524 | m: put "~", %*ENV<HOME>; | 14:35 | |
| Raku eval | ~/home/glot | ||
| sailkite | i don't have a strong reason for asking this, but is there a way to use the reduction metaoperator with infix feed operators? i've tried naïve variations and i'm clearly not groking something | 17:08 | |
| ab5tract | sailkite: one way to get things working with feeds is to wrap them in a block that calls itself | 17:35 | |
| m: dd do 1..10 ==> { [+] @_ }() | 17:36 | ||
| camelia | 55 | ||
| ab5tract | But also in RakuAST you could use a helper class to make it read a bit more nicely | 17:37 | |
| m: Q| my $r = class :: { method reduce(*@a) { [+] @a } }.new; dd do 1..10 ==> reduce($r:) | 17:38 | ||
| camelia | ===SORRY!=== Error while compiling <tmp> Couldn't find terminator | (corresponding | was at line 1) at <tmp>:1 ------> @a } }.new; dd do 1..10 ==> reduce($r:)<HERE><EOL> expecting any of: | |
||
| ab5tract | m: Q| my $r = class :: { method reduce(*@a) { [+] @a } }.new; dd do 1..10 ==> reduce($r:) |.AST.EVAL | ||
| camelia | 55 | ||
| ab5tract | or less cryptically: | 17:40 | |
| m: Q| class Assist { method reduce(*@a) { [+] @a } }; dd do 1..10 ==> reduce(Assist:) |.AST.EVAL | |||
| camelia | 55 | ||
| sailkite | i guess in an extremely arcane and purely didactic sense, i was wondering about a hypothetical case where there's some concept like this raku my @things = 2, 1, 2; @things ==> unique() ==> sort() ==> say(); and i wanted to somehow manipulate that into a means of using [==>]. i know that it's possible to just simply method chain it @things.unique.sort.say, but i couldn't help but feel curious. | 18:05 | |
| ab5tract | Ah, so that's what you meant :) | 18:22 | |
| I don't think that's possible because there's no way to pass the call in a list (as far as I know, anyway!) | 18:24 | ||
| so even if you could do: [==>] @a, unique(), sort(), say() -- it would fail because you would have the result of those calls in the list instead | |||
| but as you've noticed, [==>] and other attempts won't work either because the feed operator is not a higher level Raku infix routine, even though it dresses like one for the party | 18:26 | ||
| nahita3882 | with explicit .reduce there is something, but not that dramatic: | 18:30 | |
| m: my @a = 12, 3, 4, 3; [@a, &unique, &sort, &say].reduce: { &^fun(@^arg) } | 18:31 | ||
| Raku eval | (3 4 12) | ||
| nahita3882 | order-preservingness of .unique is appreciated; in CPython, e.g., one does [*dict.fromkeys(arr)] to that effect (PyPy guarantees [*set(arr)] is ok) | 18:36 | |
| sailkite | much appreciated, thanks for indulging me 😅 | 18:58 | |
| jubilatious1_98524 | m: List.new(12, 3, 4, 3) ==> unique() ==> sort() ==> say(); | 19:44 | |
| Raku eval | (3 4 12) | ||
| ab5tract | nahita3882++ | 19:57 | |
| always enjoy reading your code snippets | |||
| habere-et-disper | Is there a simple/portable way to test from raku if the terminal supports non-ASCII? I'm writing to STDOUT and I want to know if it can handle UTF8. | 19:59 | |
| lizmat | habere-et-disper: japhb might know, but they're not on this channel | 20:18 | |
| or patrickb | |||
| they are on #raku | |||
| jubilatious1_98524 | habere-et-disper: Dunno if this is helpful: unix.stackexchange.com/a/800915/227738 | 20:19 | |
| 5 Nov 2025 | |||
| antononcube | More or less the same is done in Mathematica when implementing monadic pipelines. | 01:09 | |