🦋 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 available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 8 June 2022.
00:00 xinming left, reportable6 left, nativecallable6 left, quotable6 left, sourceable6 left, notable6 left, tellable6 left, releasable6 left, shareable6 left, greppable6 left, bloatable6 left, sftp left, ecocode left, perlmaros left, ilogger2 left, tinita left, elcaro left, a3r0 left, Sevalecan left, Scotteh left, tib left, ecocode_ joined, a3r0 joined, perlmaros joined, elcaro joined, tib joined, tinita joined 00:02 Scotteh joined, sftp joined, Sevalecan joined 00:03 ilogger2 joined
japhb "Zipping" conceptually has a reasonable default realization that makes sense as a "simplest version" of its general operation. What would be your expected default realization for "operator reversing"? 00:05
00:06 xinming joined 00:09 reportable6 joined
habere-et-disper I don't know. I hadn't thought about it as operator reversing and as just reversing. Your terminology is helpful (I see no official docs on R yet?). Thank you japhb! 00:13
guifa_ habere-et-disper docs.raku.org/language/operators#i...taoperator 00:14
00:25 lichtkind left 00:27 habere-et-disper left 00:46 greppable6 joined, releasable6 joined 01:38 Sankalp left 01:42 Sankalp joined 01:46 notable6 joined 01:47 shareable6 joined, bloatable6 joined 01:48 tellable6 joined, quotable6 joined 01:54 frost joined 02:48 nativecallable6 joined 03:48 evalable6 left, linkable6 left 03:49 evalable6 joined 03:50 linkable6 joined 03:53 sourceable6 joined 04:53 greppable6 left, shareable6 left, committable6 left, nativecallable6 left, unicodable6 left, coverable6 left, reportable6 left, quotable6 left, evalable6 left, linkable6 left, benchable6 left, statisfiable6 left, bisectable6 left, releasable6 left, tellable6 left, bloatable6 left, notable6 left 04:54 unicodable6 joined, reportable6 joined, releasable6 joined, coverable6 joined, benchable6 joined, evalable6 joined 04:55 bisectable6 joined, committable6 joined, greppable6 joined, quotable6 joined, notable6 joined 04:56 nativecallable6 joined, linkable6 joined, tellable6 joined, shareable6 joined, bloatable6 joined, statisfiable6 joined 05:56 reportable6 left, sourceable6 left, releasable6 left, committable6 left, unicodable6 left, notable6 left, bisectable6 left, bloatable6 left, nativecallable6 left, tellable6 left, shareable6 left, benchable6 left, quotable6 left, coverable6 left, greppable6 left, evalable6 left, statisfiable6 left, linkable6 left 05:57 releasable6 joined, unicodable6 joined, shareable6 joined, notable6 joined 05:58 quotable6 joined, committable6 joined, bisectable6 joined, greppable6 joined, benchable6 joined, evalable6 joined 05:59 nativecallable6 joined, linkable6 joined, bloatable6 joined, statisfiable6 joined, sourceable6 joined, reportable6 joined, tellable6 joined, coverable6 joined 06:06 reportable6 left 06:08 reportable6 joined 06:30 abraxxa joined 06:33 abraxxa left, abraxxa joined 06:47 abraxxa1 joined 06:48 abraxxa left 06:56 Sgeo left 07:21 [Coke] joined 07:23 sena_kun joined 07:25 [Coke]_ left
SmokeMachine does ae think somenthig like this is interesting for Raku? usercontent.irccloud-cdn.com/file/...6%402x.png 08:07
Nemokosch what is ae? 08:09
SmokeMachine sorry? 08:10
Nemokosch > does ae think somenthig like this is interesting for Raku 08:11
exactly... sorry? 😄
SmokeMachine sorry... my machine is not working very well... my intention was to write: `Does anyone think something like this is interesting for Raku` 08:12
for some reason `anyone` become `ae`... 08:13
Kaiepi what is it exactly? port of Maybe? 08:14
SmokeMachine Kaiepi: my intention is a port of functors, applicatives and monads (I'm trying to study it) and some useful monads, like Maybe... 08:15
Kaiepi you're gonna run into trouble eventually without higher kinded generics for niceties like MaybeT 08:16
SmokeMachine currently it's Maybe[T]...
Kaiepi the monad transformer 08:17
SmokeMachine Kaiepi: I haven't step there yet... :) (sorry, I don't know what's that about)
I think this is a bit better (explicit return type will probably be required in the next version): usercontent.irccloud-cdn.com/file/...7%402x.png 08:19
Kaiepi Semigroup and Monoid would be nice 08:22
Nemokosch why would it? 08:29
08:29 Kaiepi left
SmokeMachine maybe this would also be interesting? usercontent.irccloud-cdn.com/file/...2%402x.png 08:35
Voldenet it's a good idea, but in practice needs really good language support 09:11
otherwise it's either slow or painful to use 09:12
btw, currying already exists 09:16
m: my &bla = * / *; &bla = &bla.assuming(*, 2); say &bla(10)
camelia 5
09:29 evalable6 left, linkable6 left 09:31 linkable6 joined 09:32 evalable6 joined
Voldenet ofc, Maybe[T] is useful in some cases, but in most of those you can simply use one-element lists for everything 09:46
e.g. 09:47
m: sub split-email { $^optional-email.map: { .contains("@") ?? .split("@").tail !! |() } }; say ("abc@def.ghi").&split-email;
camelia (def.ghi)
Nemokosch Well, what is it useful for? 09:48
I feel like a good share of this stuff comes from insisting on a type system
Voldenet Building enormously long chains of maybe-based calls
SmokeMachine Voldenet: I tried simply using .assuming, but I found using curry implicitly easier...
Voldenet well, .assuming had one gigantic performance problem in the past 09:49
`&f.assuming(*, 2);` was slower than `{ &f($^a, 2) }` 09:50
iirc rakuast is doing something about it
Nemokosch that's indeed quite a problem...
why `&`f, tho 09:52
is that a call or not?
SmokeMachine about the 1 element list, doing that that way, you need to expect the list, right? isn't the monad/bind advantage that you can use functions that expect only the value and return a monad? (I'm still studying it... I may have misunderstood) 09:53
(I may have misunderstood it) 09:54
Voldenet (it was just an example, actual currying would require capturing original function and creating new one) 09:55
m: my &bla = * / *; &bla = -> &f { -> $x { &f($x, 2); } }(&bla); say &bla(10); say now - BEGIN now 09:56
camelia 5
0.016728923
Voldenet m: my &bla = * / *; &bla = &bla.assuming(*, 2); say &bla(10); say now - BEGIN now
camelia 5
0.079365177
Voldenet ye, still painfully slow
SmokeMachine: Not quite, it's the monad that decides whether the function will be applied or not, so you first have to convert value into a monad to call a function 09:57
09:57 lichtkind joined
SmokeMachine yes, but the function itself receives the value, not the monad, right? that the reason for the bind, right? 09:58
Voldenet Yes
consider this:
m: sub maybe { (try &^f($^a)) // Any }; sub split-email { $^email.split("@")[1..*].tail }; say Any.&maybe(&split-email);
camelia (Any)
SmokeMachine like, on my example, split-email and split-domain receives a Str, and not a Maybe[Str] 09:59
Voldenet you can also do `$^a ?? &^f($^a) !! Any` 10:00
SmokeMachine yes, but I'll need to do that on every function I'd bind in sequence... with Maybe and bind it will just not call the function, right? 10:01
El_Che (not that someone is asking, but you can have more @ if quoted, or no @ at all, eg using !) 10:03
SmokeMachine El_Che: sorry, I didn't get it 10:04
I was also wondering if containers could be Monads... Positional already kind of is, right?
El_Che SmokeMachine: being pedanrtic about sub split-email { $^email.split("@")[1..*].tail } :)
SmokeMachine El_Che: :) 10:05
Voldenet SmokeMachine: also correct, that's why I said that it has its uses
still: Maybe(Any).map(&split-email).map(&split-domain) isn't much better 10:07
and using an operator for this is going to introduce some weird-looking syntax 10:08
SmokeMachine I thought this would work... but it didn't: usercontent.irccloud-cdn.com/file/...9%402x.png 10:16
my bad, I meant this: usercontent.irccloud-cdn.com/file/...9%402x.png 10:18
Voldenet either way, it introduces weird style 10:34
Nemokosch what doesn't work about it? 10:38
seems to me that it did exactly what one would expect 10:39
Voldenet …or you could just skip all that nonsense and get to the point 10:51
m: sub split-email(Str:D $e) { $e.split("@")[1..*].tail }; sub split-domain(Str:D $d) { $d.split(".").head }; say try { "abc".&split-email.&split-domain };
camelia Nil
10:53 Kaiepi joined
Nemokosch aand it would still be nil 😄 10:54
Voldenet but in this case, it's possible to do this: 10:57
sub split-email(Str:D $e) { $e.split("@")[1..*].tail }; sub split-domain(Str:D $d) { fail "domain has no dot" unless $d.contains("."); $d.split(".").head }; say try { "abc@def".&split-email.&split-domain } // $!;
evalable6 domain has no dot
in sub split-domain at /tmp/L3gDILjdSj line 1
in block <unit> at /tmp/L3gDILjdSj line 1
Nemokosch what is the significant difference? 10:58
Voldenet you can know why did you get an empty result… ;) 10:59
Nemokosch I mean... actually not convinced by that, lol 11:01
especially regarding the split-email 11:02
Voldenet …uh uh :) 11:05
`Type check failed in binding to parameter '$d'; expected Str but got Nil (Nil)` is telling you why things failed :)
SmokeMachine But a Either would also do that, right?! 11:06
11:06 dogbert2 joined 11:10 dogbert17 left
Voldenet yes, but it'd be another layer of pain, because now you'd have to convert any non-either subs to new conventions… and you have no language support 11:11
11:15 frost left 11:19 frost joined
Nemokosch split-email doesn't really show why you got Nil in the first place 11:25
Voldenet it might lack a few checks… 11:27
…probably all of them
SmokeMachine usercontent.irccloud-cdn.com/file/...1%402x.png 11:30
better: usercontent.irccloud-cdn.com/file/...1%402x.png 11:33
Voldenet there's one problem with this - you have to type Result and Error separately 11:50
11:50 dogbert2 left
Voldenet I bet you can add a coercer for this 11:50
so the code can become `… –> Either[Str, Str] { $email.contains("@") ?? ok $email.split("@").tail !! error "Invalid email" }` 11:51
or `–> Either[Str, Str]()` 11:53
11:53 dogbert11 joined
SmokeMachine yes, I'm planing doing that... `-> Either[Str, Str]() { Bool.pick ?? right "ok" !! left "error" }` would coerce and also `-> Maybe[Int]() { nothing }` 11:59
but I haven't done that yet... 12:00
12:07 reportable6 left
Nemokosch something else 12:08
what gets passed to <?{}> in regex?
12:09 reportable6 joined
SmokeMachine what am I doing wrong? 12:24
m: role Left[$, $] { ... }; role Either[::L = Any, ::R = Any] { multi method COERCE(Left[L, Any] (L :$value)) { Left[L, R].new: :$value } }; role Left[::L = Any, ::R = Any] does Either[L, R] { has L $.value; }; my Either[Str, Str]() $a = Left[Str, Any].new: :value("error")
camelia Type check failed in assignment to $!value; expected L but got Str ("error")
in method COERCE at <tmp> line 1
in block <unit> at <tmp> line 1
SmokeMachine m: say "abc" ~~ /.*<?{ False }>/ 12:25
camelia Nil
SmokeMachine m: say "abc" ~~ /.*<?{ 1 == 1 }>/
camelia 「abc」
SmokeMachine Nemokosch: you mean like this 👆? 12:27
tellable6 SmokeMachine, I'll pass your message to Nemokosch
SmokeMachine m: role Left[$, $] { ... }; role Either[::L = Any, ::R = Any] { multi method COERCE(Left[L, Any] (L :$value)) { Left[L, R].new: :$value } }; role Left[::L = Any, ::R = Any] does Either[L, R] { has $.value; }; my Either[Str, Str]() $a = Left[Str, Any].new: :value("error") # worst 12:33
camelia Impossible coercion from 'Left[Str,Any]' into 'Either[Str,Str]': method COERCE returned an instance of Left[L,R]
in block <unit> at <tmp> line 1
SmokeMachine should this be working? 👆
m: role Left[$, $] { ... }; role Either[::L = Any, ::R = Any] { multi method COERCE(Left[L, Any] (L :$value)) { Left[L.WHAT, R.WHAT].new: :$value } }; role Left[::L = Any, ::R = Any] does Either[L, R] { has $.value; }; my Either[Str, Str]() $a = Left[Str, Any].new: :value("error") # this seems to work 12:34
camelia ( no output )
SmokeMachine m: role Either[::L = Any, ::R = Any] {}; role Left[::L = Any, ::R = Any] does Either[L, R] { has L $.value; }; sub a(-->Either[Str, Str]()) { Left[Str, Str].new: :value("error") }; say a # Should it be trying to coerce??? Left[Str, Str] does Either[Str, Str] 12:54
camelia Left[Str,Str].new(value => "error")
SmokeMachine oh! it isn't working on mi machine... let me update Raku...
12:57 Xliff joined
Nemokosch > Nemokosch: you mean like this 👆? 13:03
yes, I mean like that 🙂
SmokeMachine Voldenet: now it works: usercontent.irccloud-cdn.com/file/...3%402x.png 13:10
Voldenet regarding Either, it's nice to have such a feature that can coerce Either[L, R] into T when L is T or R is T 13:14
SmokeMachine And maybe Failure/Exception into Left... 13:17
Voldenet doc.rust-lang.org/std/result/enum.Result.html 13:18
13:53 vrurg_ joined, vrurg left
[Coke] docs.raku.org/language/operators#i...taoperator (Docs for R) 14:00
14:08 Sgeo joined 14:21 dogbert17 joined, dogbert11 left 14:26 ismustachio left 15:26 notable6 left, greppable6 left, statisfiable6 left, reportable6 left, evalable6 left, quotable6 left, linkable6 left, shareable6 left, coverable6 left, committable6 left, tellable6 left, nativecallable6 left, bloatable6 left, benchable6 left, sourceable6 left, releasable6 left, unicodable6 left, bisectable6 left 15:27 tellable6 joined, shareable6 joined, reportable6 joined, quotable6 joined, notable6 joined, coverable6 joined, bisectable6 joined, evalable6 joined, linkable6 joined, bloatable6 joined 15:28 sourceable6 joined, greppable6 joined, committable6 joined, releasable6 joined, benchable6 joined, nativecallable6 joined, statisfiable6 joined 15:29 unicodable6 joined 15:38 frost left 15:42 sftp left 15:43 sftp joined 15:44 Xliff left 15:57 ismustachio joined 16:28 razetime joined 16:33 dogbert11 joined 16:35 dogbert17 left 16:50 dogbert11 left 16:52 dogbert11 joined 17:05 dogbert17 joined, dogbert11 left 17:21 razetime left 18:07 reportable6 left 18:09 reportable6 joined
[Coke] doc visit today. They couldn't do my blood draw because they couldn't get into my chart.... because they were rolling out a new version of the software, and someone 10 states away was "in" my chart somehow. The future sucks! :) 18:38
[Coke] yawns. 18:45
19:09 linkable6 left, evalable6 left, linkable6 joined, evalable6 joined 19:11 vrurg_ left 19:13 vrurg joined 19:28 sena_kun left 19:29 sena_kun joined 19:36 discord-raku-bot left, discord-raku-bot joined 19:37 discord-raku-bot left, discord-raku-bot joined
SmokeMachine How my functional suiting is going: github.com/FCO/raku-functional/blo...ample.raku 19:42
Nemokosch seems rather sadistic ngl 19:43
iirc Erlang also wasn't this dogmatic 19:45
[Coke] someone have some shorthand for turning my @a=<a b c d> into my %h<a><b><c><d>=True ? 19:51
gfldex m: my @a=<a b c d>; my %h{||@a} = True; dd %h; 19:52
camelia Odd number of elements found where hash initializer expected:
Only saw: Bool::True
in block <unit> at <tmp> line 1
gfldex my @a=<a b c d>; (my %h){||@a} = True; dd %h; 19:53
evalable6 Hash %h = {:a(Bool::True), :b(Any), :c(Any), :d(Any)}
gfldex m: use v6.*; my @a=<a b c d>; (my %h){||@a} = True; dd %h; 19:54
camelia Hash %h = {:a(${:b(${:c(${:d(Bool::True)})})})}
gfldex [Coke]: ^^^ yes but v6.*
SmokeMachine: tyvm, I learned something from github.com/FCO/raku-functional/blo...akumod#L21 19:58
Nemokosch and what was the new thing? 20:06
damn, I will learn the names eventually 20:07
gfldex is the one who always blogs a little... 20:08
20:17 perlbot left
gfldex I did not realise that I can chain methods calls after a call to `.none` and friends.` 20:19
20:19 simcop2387 left
Nemokosch oh 20:20
well I don't even know if I knew it or not xD
gfldex I used FALLBACK in the same way as Junction does (or could, without -O) but didn't make the connection to `.none`, which I used a lot. 20:22
20:31 mexen left 20:58 sena_kun left
altreus™ Anyone know how to configure raku.vim to fold POD blocks? If I let raku_fold=1, then it just folds my entire class and doesn't seem to have multiple levels of fold ... 21:21
Looks like I tried to figure it out a year ago github.com/Raku/vim-raku/issues/32 21:27
21:58 evalable6 left, linkable6 left 21:59 linkable6 joined 22:01 evalable6 joined 23:01 linkable6 left, evalable6 left 23:03 evalable6 joined 23:04 linkable6 joined 23:24 abraxxa1 left
Geth ecosystem: 598b19565d | (Richard Hainsworth)++ (committed using GitHub Web editor) | META.list
Update META.list

Migrating finanalyst/Collection to fez
23:31
23:34 lichtkind left