🦋 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 still being worked out
Set by lizmat on 12 August 2021.
vrurg greppable6: Cache::Async 02:16
greppable6 vrurg, 40 lines, 1 module: gist.github.com/bdeaaa12b890556adf...1d36de3fef
vrurg So, unless it's used in private projects... 02:17
Geth flycheck-raku: eca94662ac | (Siavash Askari Nasr)++ | flycheck-raku.el
Add project root to include path, instead of `lib` directory
09:09
flycheck-raku: 50ac228e65 | (Siavash Askari Nasr)++ | flycheck-raku.el
Bump version to 0.6
wanko hi, I was wondering, does raku support multi-parameter typeclasses? I checked docs.raku.org/language/haskell-to-...ypeclasses but well "TODO" 10:13
lizmat you mean something like Rational[Int,Int] ? 10:15
moritz my knowledge of haskell is pretty rusty and incomplete, but I think roles are the closes thing in raku 10:16
and those can be parameterized
though in general, my feeling is that if you want to super-strong typing (a la haskell), raku is going to disappoint you
wanko oh, I think I see, thanks both of you. so Rational takes 2 parameters and by doing class Positive does Rational[UInt] you basically supply Positive as the second argument, right? 10:21
moritz not quite 10:22
Rational wants two parameters, so trying to write Rational[UInt] is an error
(ok, Rational has a default, iirc, so it's not actually an error, but if there was no default...) 10:23
(just to be clear, a Rational in raku is a fraction of two integers) 10:24
wanko I think I get it now, thank you! 10:28
SmokeMachine_ Hi you all! I have a question: Match objects has submaches that you can access as $match<submatch>, isn’t it an Associative way of accessing/storing it? So, wouldn’t it make sense to Match “does” Associative? 10:51
m: say Match ~~ Associative 10:54
camelia False
moritz SmokeMachine_: Match used to be Associative when I was last very active in raku land, so it has changed since then 11:54
maybe because Associative has certain expectations of what happens if you call .list, which clash with the expectations of the Positional aspects
likewise with .keys, .pairs etc
andinus` ,ping 12:12
andinus m: put "ping" 12:13
camelia ping
SmokeMachine_ moritz: thanks! But Mach does have .keys, .pairs, etc like Associative, doesn’t it? 12:43
m: say (“bla ” ~~ /<ws>/).keys 12:44
camelia (ws)
SmokeMachine_ m: say (“bla ” ~~ /<ws>/).pairs
camelia (ws => 「」)
SmokeMachine_ m: say (“bla ” ~~ /<ws>/).kv 12:45
camelia (ws 「」)
SmokeMachine_ m: say (“bla ” ~~ /<ws>/).antipairs
camelia (「」 => ws)
andinus i 'm writing something to parse call logs, i was thinking of an interactive program that displays charts/graphs for each number if the user chooses it 12:47
should i try ncurses or is there a better way to do this? 12:48
Xliff replit.com/@Xliff/GiantChocolateSp...#main.raku 13:21
Why the differing results between the two grammars?
Thanks.
andinus: Yes, you can use curses, or a GUI lib. Raku does have GTK bindings. 13:31
If you want simple plotting, there is SVG::Plot, but that is for generating SVGs, not displaying them. 13:32
andinus which GUI lib is recommended? i haven't wroked with any before 13:43
i was thinking of using curses to provide menu based interface and generating plots with svg::plot and displaying them with feh 13:44
Xliff If I have an arbitrary prefix string, that may change. How can I use a regular expression to match any character up to that string? 15:28
So....
moritz .*? <?before $string< 15:34
.*? <?before $string>
Xliff moritz++!
Is there a way to do that where "$string" is a scalar or an array? Or is that what you meant by "$string"? 15:37
Moritz: So something like this seems to work: replit.com/@Xliff/GiantChocolateSp...#main.raku 15:44
Working version of reusable parser: replit.com/@Xliff/GiantChocolateSp...#main.raku 15:51
moritz: Thanks AGAIN!
Juerd I love that I can just use ½ * tau * ($d/2)² 16:39
cnx m: put τ 16:43
camelia 6.283185307179586
Shaeto hmm, can't download the latest community commaide, mac os link is broken... and no information how to contact authors 18:09
moon-child ping jnthnwrthngtn 18:22
nine moon-child: on vacation 18:23
moon-child right 18:24
MasterDuke Altai-man and timo are also involved with comma development 19:16
Altai-man thinks what to do 19:18
Shaeto, hi. Alas, it's a known problem, for the time being it's not possible to build an OSX build for the latest version. Tomorrow I'll update the link to download 7.0 instead, I guess. It goes with some unfortunate bugs, so I am not sure what's the best way to proceed. 19:21
Shaeto Altai-man: thank you! 19:22
Altai-man I can ship the buggy 7.0 for OSX or we can wait some days until it'll be possible to ship 7.1 properly.
Shaeto stable 7.1 is more interesting :) 19:23
Xliff m: my $a = Seq(1, 2, 3); $a.^name.say; $a.elems.say; $a.gist.say 19:31
camelia Seq
3
(1 2 3)
Xliff m: my $a = Seq(1, 2, 3); $a.^name.say; $a.elems.say; $a.gist.say; $a.gist.say
camelia Seq
3
(1 2 3)
(1 2 3)
Xliff m: my $a = Seq(1, 2, 3); $a.^name.say; $a.elems.say; .say for $a; .say for $a 19:32
camelia Seq
3
(1 2 3)
(1 2 3)
Xliff m: my $a = Seq(1, 2, 3); $a.^name.say; $a.elems.say; $a.^name.say; .say for $a; .say for $a
camelia Seq
3
Seq
(1 2 3)
(1 2 3)
Xliff Why isn't that Seq complaining about it being used up?
moon-child Seq is an Iterable, not an Iterator 19:34
mjgardner Can someone explain `first` and smartmatch (`~~`) to me? I’m trying to use them in the attached script that uses Perl’s WWW::Mechanize, and although I can do a regular `eq` in `first` I can’t see how to check against a list (`$rss_types` in the example). www.irccloud.com/pastebin/lmQ7jGHc 19:57
lizmat m: dd "a" ~~ <a b c d> # mjgardner smartmatch won't work that way 20:00
camelia Bool::False
lizmat m: dd "a" (elem) <a b c d> # mjgardner perhaps this will?
camelia Bool::True
[Coke] docs.raku.org/routine/ACCEPTS - this shows what smartmatch does with a list, btw. 20:01
[Coke] elem should work, an explicit junction should work ~~ any($rss_types) 20:01
mjgardner lizmat: (elem) works 🙂 20:02
[Coke]: `say $alt_links.first(*.attrs<type> ~~ any($rss_types)).url;` gets me a compiler error: Function "any" may not be called without arguments (please use () or whitespace to denote arguments, or &any to refer to the function as a noun, or use .any if you meant to call it as a method on $_) 20:05
But (elem) works so I’ll go with that. 20:06
[Coke] try 'eq' instead of ~~ there.
mjgardner Nope, that gets me Nil. 20:08
MasterDuke what if you give $rss_types a `@` sigil? 20:11
m: my $a = <a b ab abc d>; say "abc" ~~ any($a); my @b = <a b ab abc d>; say "abc" ~~ any(@b) 20:12
camelia False
True
[Coke] Apologies for the bad advice, always trust lizmat. :) 20:14
mjgardner MasterDuke: That only works if I do `.first( {$_.attrs<type> ~~ any(@rss_types) } )`, but that’s a bit noisier than lizmat’s (elem), so I’m going with the latter. 20:18
MasterDuke sure. elem going to be faster anyway, just showing how it could/would work 20:20
mjgardner Thanks for the help all. 20:23
japhb andinus: There's some rough stuff in github.com/japhb/Terminal-QuickCharts, but that's more for making a CLI output a chart, than to have live charts going in a TUI app. There's also github.com/ab5tract/Terminal-Print which is relatively low level. (It has the underlying code to do animatable widgets, but it has NO widget library. Just the low-level bits.) 21:22