ūü¶č Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | Log inspection is getting closer to beta. If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 25 August 2021.
00:09 reportable6 left 00:14 Kaipi left 00:15 Kaipi joined
moon-child m: sub g($label) { last $label }; sub f { LOOP: for ^5 { say $_; g LOOP }; }; f() 00:19
camelia 0
moon-child I want to write something like ^, but with map instead of for. Is that possible? 00:20
01:11 reportable6 joined 01:17 jgaz joined 02:00 swaggboi left 02:06 frost joined 02:08 jgaz left 02:11 swaggboi joined 03:11 coverable6 left, linkable6 left, quotable6 left, statisfiable6 left, committable6 left, unicodable6 left, reportable6 left, squashable6 left, greppable6 left, nativecallable6 left, evalable6 left, tellable6 left, bisectable6 left, bloatable6 left, releasable6 left, shareable6 left, sourceable6 left, notable6 left, benchable6 left 03:12 bisectable6 joined, squashable6 joined, nativecallable6 joined, linkable6 joined 03:13 quotable6 joined 03:14 shareable6 joined, evalable6 joined, tellable6 joined 03:15 releasable6 joined 04:04 MasterDuke left 04:13 sourceable6 joined, greppable6 joined, notable6 joined 04:14 statisfiable6 joined, committable6 joined 05:12 bloatable6 joined, reportable6 joined 05:13 coverable6 joined 05:14 unicodable6 joined 06:07 reportable6 left 06:12 benchable6 joined 06:55 discord-raku-bot left, discord-raku-bot joined 07:02 djerius left 07:04 djerius joined 07:08 jjido joined 07:09 reportable6 joined 07:15 abraxxa joined 07:21 abraxxa left, clarjon1 joined, abraxxa joined 07:23 jjido left 07:38 jjido joined 08:00 tejr left, tejr joined 08:01 Darkcoal joined
Geth ecosystem: 26698f7b77 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | META.list
Freeze Test::When
08:42
08:56 Sgeo left 09:00 andrea[m] left 09:06 sena_kun left 09:08 sena_kun joined
Geth ecosystem: 330333dd65 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | META.list
Freeze IO::Dir
09:15
09:26 jjido left 10:01 discord-raku-bot left 10:03 gfldex left, gfldex joined 10:05 discord-raku-bot joined 10:13 sena_kun left 10:14 sena_kun joined 10:26 ShaneC left 11:26 linkable6 left, statisfiable6 left, bloatable6 left, unicodable6 left, benchable6 left, coverable6 left, notable6 left, nativecallable6 left, squashable6 left, committable6 left, quotable6 left, reportable6 left, tellable6 left, releasable6 left, shareable6 left, evalable6 left, sourceable6 left, greppable6 left, bisectable6 left 11:27 unicodable6 joined 11:28 shareable6 joined, bloatable6 joined, linkable6 joined, sourceable6 joined, benchable6 joined 11:29 committable6 joined, notable6 joined, coverable6 joined, evalable6 joined 11:31 razetime joined, thowe left 11:35 jjido joined 11:43 Altai-man joined 12:06 jjido left 12:10 reportable6 joined 12:14 discord-raku-bot left, discord-raku-bot joined 12:27 bisectable6 joined 12:33 razetime left
Voldenet m: sub g($lbl is rw) { $lbl = True }; my $*LOOP = False; say reduce( -> $acc, $_ { my $v = $*LOOP ?? ($acc) !! (|$acc, $_); g($*LOOP); $v }, (), |^5); 12:37
camelia (0)
Voldenet moon-child: ^ that's not map, but it's close to how fprog would solve this (I'm not sure if it's even always guaranteed to work) 12:39
m: sub g($states, $key) { $states{$key} = False }; say reduce( -> (%d, $acc), $_ { my $v = %d<LOOP> ?? (|$acc, $_) !! ($acc); g(%d, <LOOP>); say (%d, $acc, $_); (%d,$v) }, (%(:LOOP), ()), |^5); 12:48
camelia ({LOOP => False} () 0)
({LOOP => False} (0) 1)
({LOOP => False} (0) 2)
({LOOP => False} (0) 3)
({LOOP => False} (0) 4)
({LOOP => False} (0))
Voldenet output is fairly disgusting as expected
12:48 razetime joined
Voldenet in fact, for loop seems like a better solution for this 12:58
13:16 frost left 13:17 abraxxa left 13:19 abraxxa joined 13:24 abraxxa left 13:28 greppable6 joined, statisfiable6 joined 13:29 releasable6 joined 14:05 epony left 14:25 sena_kun_ joined, Altai-man left 14:27 nativecallable6 joined, tellable6 joined 14:29 quotable6 joined 14:32 razetime left 14:42 morte_ joined 14:43 razetime joined
[Coke] say:print::note:? 14:59
$*ERR.print? 15:00
15:00 epony joined 15:13 jjido joined 15:29 squashable6 joined 15:31 jjido left 15:35 Sgeo joined
japhb [Coke]: note ~? (Stringifying the argument first) 15:50
16:14 discord-raku-bot left, discord-raku-bot joined 16:18 jjido joined
[Coke] Was referring to newline addition. 16:20
but yes, having gist vs. str in the mix is also confusing. 16:21
japhb Oh yeah, I guess I was thinking say:put 16:25
16:32 Altai-man joined 16:36 sena_kun_ left 17:16 razetime left, Kaipi left 17:23 Kaiepi joined 17:29 aru joined 17:36 epony left 17:37 epony joined
aru Hi, i've been looking at raku and ocasionally I'm confused by its syntax and where ceratin things can be used. For example with grep, I'm never sure if I have to do grep({ .something }), or grep(*.something), or grep: { .something } or something else altogether. Is there a rule of thumb for these cases? 17:39
lizmat the rule is that .grep takes a Callable 17:40
{ .something } and *.something are different syntaxes for basically the same tihng
aru are they? I could have sworn there were cases when one worked and the other did not, but maybe I was doing something else wrong 17:41
lizmat also .grep({ ... }) and .grep: { ... } are also just different syntaxes for the same tinkg
well, *.foo is syntactic sugar.... and the syntax to convert an expression with * into a Callable are (intentionally) limited 17:42
aru ok, makes sense, thanks 17:45
and another thing, when it comes to specifying types. Can I express something like "a list of lists of Str*Int pairs"? 17:46
gfldex Type checks happen (mostly) at runtime and you can check for anything you like. 17:53
17:57 Tirifto left 18:00 Tirifto joined
aru right 18:01
18:07 reportable6 left 18:10 reportable6 joined 18:29 Altai-man left 18:36 morte_ left
Voldenet aru: this is mostly my personal opinion, but I really prefer the most uniform syntax in raku, so `.grep({ $^x })` which can be used almost everywhere 18:43
`.grep: { }` feels weird to use 18:45
`*.something` is convenient when you chain a lot of methods together 18:49
like `($^d.IO.dir // ()).grep(!*.basename.starts-with('.')).grep(*.d).grep(!*.l)` 18:53
also, WhateverStar has some limitations: 19:00
m: (&say, &dd).map(*("test")).say
camelia No such method 'CALL-ME' for invocant of type 'Whatever'
in block <unit> at <tmp> line 1
Voldenet m: (&say, &dd).map({.("test")}).say
camelia test
"test"
(True Nil)
19:02 sena_kun left 19:03 sena_kun joined
japhb m: (&say, &dd).map: *.("test") # Curious 19:08
camelia No such method 'CALL-ME' for invocant of type 'Whatever'
in block <unit> at <tmp> line 1
japhb Yeah, figured
19:17 ShaneC joined
aru understood, thanks 19:22
20:02 jjido left 20:32 Darkcoal left 20:43 lichtkind joined 21:26 Util left 21:36 tejr left 21:37 tejr joined 21:49 jmcgnh left 21:56 jmcgnh joined 22:18 kjp joined 22:24 Juerd left 22:30 clarjon_1 joined, guifa joined 22:31 lucerne8 joined 22:32 [Coke]_ joined, vrurg_ joined, samcv joined, gabiruh joined 22:34 xkr47_ joined, sjn_ joined 22:35 kjp_ joined 22:39 kjp left, clarjon1 left, avar left, xinming left, xkr47 left, [Coke] left, vrurg left, phogg left, perlmaros left, guifa_ left, sjn left, lucerne left, samcv_ left, gabiruh_ left, tib left, lucerne8 is now known as lucerne, xkr47_ is now known as xkr47 22:45 vrurg_ is now known as vrurg, avar joined, xinming joined, phogg joined, perlmaros joined 22:47 tib joined 23:29 djerius left 23:33 jjido joined 23:36 djerius joined