| 1 Mar 2026 | |||
| arkiuat | I don't run into that situation nearly as often as I want to assign to LHS but only if it's not already defined | 13:50 | |
| thanks for explaining | 13:52 | ||
| lizmat | yw :-) | 13:53 | |
| librasteve | think I’ll go and crawl into a hole (thanks for correcting me) | 13:57 | |
| arkiuat | eh, you're fine. I made a worse mistake | 14:12 | |
| you just made a typo in a question. I went blathering on answering a question that hadn't been asked | 14:13 | ||
| 2 Mar 2026 | |||
| librasteve_ | rakudoweekly.blog/2026/03/02/2026-...0-2026-02/ | 19:03 | |
| 4 Mar 2026 | |||
| modula | Hi. I'm trying to do this: gather { for (^100) { my $c = (0x20..0xFFFF).pick; try { $c = $c.chr; CATCH { next } }; take $c; } } but even though I have this wrapped in a `try` and `CATCH`, I still get errors like "Error encoding UTF-8 string: Could not encode Surrogate codepoint 55551". All I want is to run `next` to skip the current iteration if `$c.chr` throws any error. Why does this not | 08:00 | |
| work, and how can I make it work? | |||
| librasteve | hi modula | 11:02 | |
| let me see what I can make of that | |||
| hmmm - the error seems to be happening at the output stage (I prepended say to your code) | 11:18 | ||
| - I tried forcing the stringification inside the try block with $c = $i.chr.Str | 11:19 | ||
| but that did not improve matters - maybe someone more expect than I can help? | |||
| sorry | 11:20 | ||
| lizmat | modula: that's very perl like code :-) | 11:34 | |
| fwiw, that code doesn't fail for me | |||
| which version of rakudo are you using ? | |||
| ah... need a "dd" in front to make it fail | 11:35 | ||
| could it be that it is just an invalid code point that was picked ? | 11:38 | ||
| hmm.. looks like the .chr error is not trappable | 11:40 | ||
| m: .say with try 56792.chr | |||
| camelia | Error encoding UTF-8 string: could not encode Unicode Surrogate codepoint 56792 (0xDDD8) in block <unit> at <tmp> line 1 |
||
| lizmat | modula: golfed your code to: | 11:43 | |
| m: gather { for (0x20..0xFFF).pick(100) { .take with try .chr } } | |||
| camelia | ( no output ) | ||
| lizmat | m: dd gather { for (0x20..0xFFF).pick(100) { .take with try .chr } } | ||
| camelia | ("", "ݰ", "", "ଲ", "ԁ", "Æ", "Ƃ", "Ν", "", "\x[81D]", "", "", "ɕ", "ੋ", "ؤ", "Ӓ", "\x[59B]", "ˈ", "", "\x[749]", "Ǯ", "ໜ", "ۏ", "మ", "܉", "प", "", "", "ࡢ", "ಽ", "ৣ", "ໍ", "", "۾", "\x[ECB]", "… | ||
| lizmat | will make an issue for 56792.chr not being trappable | ||
| hmmm.. as librasteve noted, it's really in the stringification | 11:53 | ||
| m: say 56792.chr.ord | |||
| camelia | 56792 | ||
| lizmat | m: try say 56792.chr # trappable indeed | 11:56 | |
| camelia | ( no output ) | ||
| modula | lizmat: thanks, your golfed version works :) and yes, i'm definitely much more familiar with perl, it was my first language years ago, but i've been trying to gradually learn raku more, it seems like a very cool language. thanks again for your help! | 19:56 | |
| 6 Mar 2026 | |||
| am I doing something wrong here? my $p = run("cat", in => "foo", :out, :err); $p.out.get.raku.say; prints Nil, when i would expect it to print "foo". because when i run `echo foo | cat` in my shell, it prints "foo" as expected | 23:46 | ||
| m: my $p = run("cat", in => "foo", :out, :err); $p.out.get.raku.say; | |||
| camelia | Nil | ||
| modula | it seems like the program being called isn't actually getting the string i'm providing (or trying to provide) to its stdin | 23:51 | |
| 7 Mar 2026 | |||
| lizmat | m: my $p = run("cat", :in, :out); $p.in.say("foo"); $p.in.close; say $p.out.slurp | 07:47 | |
| camelia | foo |
||
| lizmat | modula ^^ | ||
| :in and :out are flags indicating that you want to do something with STDIN and STDOUT on that program | |||
| you must supply the input by print / say on the object returned by $p.in | 07:48 | ||
| modula | Ah, that makes more sense. I thought I saw the :in(...) way somewhere, but maybe I'm misremembering. Thanks again :) | 07:49 | |
| lizmat | yw :-) | 08:06 | |
| 10 Mar 2026 | |||
| librasteve_ | rakudoweekly.blog/2026/03/10/2026-...g-cragcli/ | 14:50 | |
| david7832 | Is there a good idiom for applying the smartmatching expression (substitution in particular) to several variables at a time? Something like $a, $b, $c ~~ s/abc/ABC/ (which does't do the desired thing, only affecting $c, since ~~ binds more strongly than the comma) | 23:42 | |
| lizmat | m: my ($a,$b,$c) = <abc def ghi>; s/abc/ABC/ for $a,$b,$c; dd $a, $b, $c | 23:44 | |
| camelia | $a = "ABC" $b = "def" $c = "ghi" |
||
| david7832 | that's perfect, thanks :) | 23:45 | |
| 16 Mar 2026 | |||
| librasteve_ | rakudoweekly.blog/2026/03/16/2026-...-day-2026/ | 16:34 | |
| 17 Mar 2026 | |||
| ab5tract | librasteve_++ | 18:32 | |