🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
00:00 wamba left 00:01 frost-lab joined 00:02 dotdotdot joined 00:08 pecastro left 00:31 RaycatWhoDat left, RaycatWhoDat joined 00:37 xinming left 00:38 xinming joined
raku-bridge <theangryepicbanana> lizmat: idk what newdisp is, but thanks for the help :) 00:58
01:17 xinming left, xinming joined 01:24 seanrobert joined 01:28 dotdotdot left 01:29 dotdotdot joined 01:31 simcop2387 left 01:33 simcop2387 joined, dotdotdot left 01:39 cpan-raku left 01:45 xinming left 01:46 xinming joined, dotdotdot joined 01:48 cpan-raku joined, cpan-raku left, cpan-raku joined 01:54 lucasb left 02:28 MasterDuke left 03:10 Black_Ribbon joined 03:19 seanrobert left 03:25 leont left 03:26 leont joined 03:27 xinming left 03:28 xinming joined 03:33 leont left 03:54 xinming left, xinming joined 04:12 xinming left, Doc_Holliwood left, __jrjsmrtn__ left 04:14 xinming joined, __jrjsmrtn__ joined 04:48 guifa2 joined
guifa2 o/ 04:49
tellable6 2020-12-16T12:10:57Z #raku <lizmat> guifa2 as the original creator of `callwith`, I think it has been a mistake to make it (at least as it currently is implemented)
2020-12-16T12:11:20Z #raku <lizmat> guifa2 so I would be in favour of deprecating callwith, hope this helps
guifa2 lizmat: I t 04:50
lizmat: that might be, but it seems the issue is more than once code is wrapped, if it somehow gets precompiled, the original one is lost. For instance, I tried using my &foo = nextcallee; foo(…); but it seems to give that same error. I'm not sure where to start digging to track down the issue though 04:52
(callsame has the same issue too). I'll try to golf it and get the issue into the new issue tracker 04:54
05:16 Doc_Holliwood joined 05:17 simcop2387 left 05:28 simcop2387 joined 05:31 xinming left, xinming joined 05:41 simcop2387 left 05:44 simcop2387 joined
elcaro todays AOC could largely be done by creating custom infix ops `p` and `t` that are assoc<left> versions of `+` and `*`, then just EVAL 06:00
06:00 rindolf joined
elcaro but it feels like cheating :) 06:00
eg. '8 * 3 + 9 + 3 * 4 * 3'.trans('+*' => 'pt').&EVAL 06:02
06:07 xinming_ joined, Summertime left 06:08 Summertime joined 06:10 xinming left 06:37 aindilis` joined 06:38 aindilis left 06:43 squashable6 left, Doc_Holliwood left 06:44 squashable6 joined 06:46 xinming_ left, xinming_ joined 07:06 guifa2 left 07:09 xinming_ left, xinming_ joined 07:11 parabolize left 07:22 jmerelo joined 07:56 sjm_uk joined 08:20 domidumont joined 08:23 Sgeo left 08:25 Altai-man joined, jmchael_ left, jmchael joined 08:36 domidumont left 08:47 pecastro joined 09:07 aborazmeh joined, aborazmeh left, aborazmeh joined 09:09 sena_kun joined 09:11 Altai-man left 09:16 wamba joined 09:19 abraxxa joined 09:23 abraxxa left 09:24 abraxxa joined 09:25 Doc_Holliwood joined 09:35 xinming_ left 09:38 xinming_ joined 09:42 wamba left 09:57 brtastic1 joined 09:59 brtastic1 is now known as brtastic 10:05 RaycatWhoDat left 10:17 skids left 10:38 domidumont joined 10:47 brtastic left 10:49 abraxxa left 10:51 xinming_ left 10:57 aborazmeh left 10:58 Doc_Holliwood left 10:59 xinming joined 11:07 abraxxa joined 11:09 wamba joined 11:28 morayj joined
lizmat drops a pin 11:52
moritz catches the pin before it hits the channel floor 11:58
tadzik quickly, someone integrate 9.81m/s² over 6 minutes and we'll see how tall (at least!) the channel is :P 12:02
12:04 leont joined 12:07 frost-lab left
moritz don't forget the air drag, which increases proportionally to v² :D 12:09
without air drag, we're at about 636km 12:11
tadzik oh no
see, here's where my university physics introduction, with it's continuous "ignore the air drag" becomes insufficient :P 12:12
timotimo just google the cw value and use the terminal velocity as a good enough approximation :) 12:14
12:21 albino left 12:22 dmc00 left 12:23 dmc00 joined
moritz or you could work with the proper diffential equations, and integrate them numerically. Pretty easy with Math::RungeKutta for example (to bring us back to topic :D ) 12:25
lizmat afk for a few hours& 12:37
12:38 albino joined, Black_Ribbon left 13:08 Altai-man joined 13:10 sena_kun left 13:15 sno left 13:21 albino left 13:42 brtastic1 joined 13:45 brtastic1 is now known as brtastic 13:48 patrickb joined 13:55 morayj left 14:01 jmerelo left, wamba left 14:37 rindolf left 14:43 rindolf joined 14:44 rindolf left, rindolf joined 14:45 ex_nihilo left 15:10 Sgeo joined 15:14 oddp joined 15:17 Celelibi joined 15:26 kensanata joined 15:39 ensamvarg3 left 15:45 aindilis` left 15:46 aindilis joined, morayj joined 15:56 parabolize joined 16:01 brtastic left 16:34 sno joined 17:09 sena_kun joined 17:11 Altai-man left, Doc_Holliwood joined 17:15 brtastic joined
tony-o .tell jmerelo fyi: github.com/ugexe/zef/pull/378 17:31
tellable6 tony-o, I'll pass your message to jmerelo
17:41 orinthe8 joined, imcsk8 left 17:43 orinthe left, orinthe8 is now known as orinthe, imcsk8 joined 17:45 Henri joined
Henri Okay, so I'm a Raku beginner. I'm trying to parse a CSV file and I have a few questions. 17:47
pastebin.com/C4FGN37H
I get the error that: The iterator of this Seq is already in use/consumed by another Seq.
And I understand the error, but am unsure how to fix it.
I tried to pull out the iterator object underneath, but then map did not type-check against the iterator object.
17:48 domidumont left
Henri Also, earlier I tried to write my multi as read-csv($filename, True) and read-csv($filename, False) as one might do in Haskell, but this did not work and was rather painful to fix. 17:48
Could someone help me out?
I'm a bioinformatics researcher and I am looking for a good functional language to do my work. 17:50
tony-o the dispatcher won't do guards
you can kind of emulate guards with `where` in the signature
Henri Python is nice, but just doesn't cut it. I'm used to the expressiveness of Clojure/Racket.
tony-o I thought you could do stuff like fact(0) = 1 17:51
tony-o m: multi sub x (Bool $x where { $_.so }) { True.say; }; multi sub x (Bool $x where { ! ($_.so) }) { False.say; }; x(True); x(False);
camelia True
False
Henri Interesting, the solution I have works now, and it kind of does the same thing, but it doesn't have the .so 17:54
What is the importance of that?
17:56 aborazmeh joined, aborazmeh left, aborazmeh joined
patrickb tony-o: Is 360.zef.pm already running on the new proto eco? 18:02
tony-o patrickb: yes 18:03
Henri: testing it, seems it's not as important anymore but evaulating junctions or other things used to warn that ! $x might not do what you'd think
i do like lisps and haskell quite a bit 18:04
Henri yes i just have the problem that they aren't scriptable for some of my needs
clojure you have to create a whole project and then run the JVM to start it up 18:05
haskell well, that has it's own difficulties
tony-o i liked clojure up to the jvm part
Henri i appreciate the JVM for the most part
perryprog I actually like that part of Clojure
Henri offers tons of great libraries
perryprog It gives you access to—yeah that
Henri seamless interop
tony-o that part is really nice
patrickb and 32.zef.pm is also the new backend, but imported p6c?
Henri have you guys been using Raku for a lot of tasks? 18:06
tony-o 32.zef.pm is p6c - 360.zef.pm is zef: auths but requires you to register/login and upload with the zef: auth
18:07 mowcat joined
tony-o the tool for doing those last three actions is WIP, i can invite you to the repo if you'd like to contribute 18:07
patrickb am interested
18:07 agentzh left
tony-o Henri: i mainly use perl/python for work, wrote a lisp-ish language in C, goof around stuff in raku 18:07
18:08 natrys joined
tony-o patrickb: are you patrickb or Patrickb on github? 18:09
patrickb tony-o: patrickbkr
tony-o invite sent
Henri tony-o I've never actually tried perl5 before 18:10
tony-o Henri: where is the Seq error in your code?
what line, i mean
Henri I figured it out!
it was with hdr
because i was realizing it multiple times 18:11
so i just added a .cache on line 5
tony-o gotcha
if you end up releasing your csv as a module check out tux's benchmark repo for csv parsers
Henri yes maybe I could if I end up using it enough 18:12
i think that raku could do with a lot of bioinformatics features
so i might make a little library for myself and push it out there
how's your experience working with grammars? 18:13
that seems to be the most attractive feature to me
tony-o grammars are slow (imo) but really powerful and pretty fun to play around with 18:14
github.com/tony-o/perl6-slang-sql
Henri speed is definitely a concern for me.
what about the regex engine?
would you say that's speedy 18:15
most of the formats I parse are line-based, so it's not really necessary to build a tree-based grammar for it
tony-o i'd test it to see if the regex suits your needs, if it doesn't then nativecall+raku is awesome to work with 18:16
speed benefits of C and the ease of use with interacting with the data in an hll is top 18:17
Henri thanks for the tip. 18:22
i'll check that out
Doc_Holliwood is this cheating? 18:32
github.com/holli-holzer/advent2020...uzzle.raku
moritz Doc_Holliwood: I consider it technique :D 18:41
18:42 wamba joined 18:50 agentzh joined 18:51 natrys left 18:58 MilkmanDan left, MilkmanDan joined 19:21 natrys joined 19:22 hal99999 joined 19:26 abraxxa left 19:28 Doc_Holliwould joined 19:31 Doc_Holliwood left
rjbs Is it "Rah-ku" or "Ray-ku" and is this documented? 19:31
19:31 hal100000 joined
Grinnz i go with what this says translate.google.com/?sl=ja&tl...=translate 19:32
19:33 hal99999 left
tony-o if i ever say it aloud i say it like he beginning of raccoon 19:46
19:47 warriors joined
warriors hi 19:48
19:52 morayj left
warriors names that start with ^ what are those called, are they methods ? 19:53
19:56 hal99999 joined
tony-o they're part of the mop 19:58
docs.raku.org/language/mop
19:58 hal100000 left
warriors thanks 19:59
Henri currying?
what's the standard strategy for this...
warriors is this why .attributes dont return them ?
tony-o Henri: do you have an example? there's array/hash flattening but it isn't purely currying 20:00
warriors: what is "them?"
Henri i have multi called parse-grna-row(Doench, %row, $idx) 20:01
warriors ^ names ( what do call this symbol by the way ^)
Henri and row is either declared as %row or @row, and I want to dynamically figure out at runtime which one it is :)
20:01 kensanata left
Henri so I think I can partially apply to first argument (an enum type) and then look at the resulting functions argument types 20:01
tony-o m: sub add ($a, $b) { say $a + $b ; }; my @a = 1, 2; add(|@a);
camelia 3
tony-o a ^ is called a caret 20:02
the dispatcher will pick the right method for @|% if your signatures are that way.. if you want to tell at runtime what a scalar is you can do $x ~~ Hash 20:03
Henri Oh nice!
Can I do the same thing for return types?
tony-o m: multi sub x(%a) { say "hash"; }; multi sub x(@a) { say "array"; }; my @a = 1, 2; my %a = 5, 1, 6, 2; x(@a); x(%a); 20:04
camelia array
hash
tony-o say more. 20:05
Henri tony-o that makes sense
say something similar, but instead my @a = sub(1) would call the array version
and my %a = sub(1) would call the hash version
tony-o what is sub(1) ? 20:06
Henri x(1)*
sorry
same input type, different return value type
warriors so why .methods dont return caret names ? and why does it return WHICH but not WHAT, in general I am trying to identify the different types of things that can have names in raku, i know for introsepection we have .methods and .attributes , but apparently they is more kinds of things, 20:07
Henri instead of your example, different input type
tony-o i don't think it could work that way 20:08
vrurg Henri: No, Raku do not dispatch depending on calling context. But you can use pass an array or a hash as a parameter and modify it in your sub. 20:11
tony-o warriors: once you're in the MOP you're in the introspection bits of raku. if you're looking for the functionality provided by _something_ then use .^mro and then inspect the raku source to figure out what else is immediately available on it. .attributes and .methods don't show up because the MOP isn't showing what it can do but the object you're calling it on 20:12
vrurg warriors: Because .^ methods belong to metamodel namespace.
warriors: WHICH is a method, WHAT is a shortcut to the core which is handled by compiler and results not in a method call but in specific bytecode. 20:13
warriors so what is WHAT exactly
a keyword
syntax? 20:14
vrurg warriors: I don't have a term for it. But "syntax" would be the closest one, perhaps. Same thing about HOW.
warriors a keyword
20:15 oddp left
vrurg In fact, $obj.WHAT is nqp::what($obj). $obj.HOW is nqp::how($obj) 20:15
warriors its part of the language, not a type of thing we can define
vrurg warriors: no, it is not because a keyword exists on its own but these are method-like entitites.
tony-o warriors: this might be helpful - github.com/rakudo/rakudo/blob/0290...l.pod#L286 20:16
warriors thanks
vrurg BTW, documentation call them 'reverved methods
docs.raku.org/language/typesystem#...ed_method)
class Foo { method ^foo { } }; say Foo.HOW.^methods 20:18
evalable6 (foo archetypes new new_type add_fallback compo…
vrurg, Full output: gist.github.com/2dc7a79b5a2a21afa3...4cafd408c9
vrurg warriors: ^ with regard to carret methods
20:52 sena_kun left 20:54 sena_kun joined, Henri left, Henri joined
Henri is there a stdout/stderr IO::Handle? 20:54
20:57 pecastro left
lizmat $*OUT 20:57
$*ERR
21:05 aborazmeh left 21:11 sena_kun left, cpan-raku left 21:12 sena_kun joined, cpan-raku joined, cpan-raku left, cpan-raku joined
ggoebel www.reddit.com/r/adventofcode/comm...;context=3 21:13
tellable6 2020-12-17T04:13:46Z #raku <coldpress> ggoebel: native types are really so much faster!
ggoebel oops sorry
21:16 sena_kun left, aborazmeh joined, aborazmeh left, aborazmeh joined
moon-child why is that, though? Int should involve one (correctly predicted, so effectively free) branch per arithmetic op for as long as they're in the range of a native type 21:20
21:28 sena_kun joined, aborazmeh left 21:30 sena_kun left 21:33 hal99999 left 21:37 sena_kun joined 21:41 hal99999 joined 21:47 sjm_uk left 21:54 xinming left 21:55 xinming joined
moritz because you first need a run-time dispatch to reach the actual numerical operation 21:56
22:10 sena_kun left
Henri For calling methods you can either use obj.method: a or obj.method(a) correct? 22:11
22:13 wamba left 22:17 guifa2 joined
raku-bridge <theangryepicbanana> Henri: yes 22:21
22:22 guifa2 left 22:31 brtastic left
leont Is there a built-in way to split a list into a list of lists, based on some separator? 22:34
moon-child m: print [1, 2, 3, 0, 1, 0, 2].split(0) 22:36
camelia 1 2 3 1 2
leont That coerces to a string first 22:37
22:41 natrys left 22:45 xinming left 22:46 xinming joined
leont r: sub split-list(@args is copy) { return gather { while @args { my @elems; while @args.shift -> $next { if $next eq "|" { take @elems.clone; @elems = () } else { push @elems, $next } }; LAST { take @elems if @elems} } } }; dd split-list <a b c | d e | f g 22:46
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in quote words; couldn't find final '>' (corresponding starter was at line 1)
at <tmp>:1
------> 3 } } }; dd split-list <a b c | d e | f g7⏏5<EOL>
expecting any…
5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in quote words; couldn't find final '>' (corresponding starter was at line 1)
at <tmp>:1
------> 3 } } }; dd split-list <a b c | d e | f g7⏏5<EOL>
expecting an…
leont r: sub split-list(@args is copy) { return gather { while @args { my @elems; while @args.shift -> $next { if $next eq "|" { take @elems.clone; @elems = () } else { push @elems, $next } }; LAST { take @elems if @elems} } } }; dd split-list <a b c | d e | f g>
camelia (["a", "b", "c"], ["d", "e"], ["f", "g"]).Seq
leont It works, but it feels like there should be a more elegant way
22:53 rindolf left 22:59 hal99999 left
elcaro gist.github.com/0racle/c57fc86a0a0...8a435872b1 23:20
leont: gist.github.com/0racle/c57fc86a0a0...8a435872b1
I too was playing around with a `split-on` function recently (i think i saw something in haskell) 23:21
none of the functions are particularly elegant, but I think B benched the fastest (B and C were pretty close, A was significantly slower)
leont B is also the one I'd find most intuitive 23:22
Henri is there a mutating version of map, or is that what the map method does? 23:23
moon-child Henri: you can use @arr .= map(&fun) 23:24
it doesn't mutate (if perf/mem use is a concern), but is otherwise a concise way to say the same thing
elcaro or if you have a list of containers, you could do .map(-> $x is rw { ... })
Henri moon-child thank's that's helpful
i'm liking raku a ton, it seems like a great alternative to bash :) 23:25
23:27 MasterDuke joined
MasterDuke leont: have you looked at classify and categorize? 23:28
leont Yeah, but they don't quite do what I want 23:29
I think I could write an implementation on top of them, but I don't see a way that's more elegant than the current options
23:30 aukkras joined 23:39 patrickb left
leont Also, is there a clean way to concatenate regexes? 23:43
moon-child m: my regex a { 'beep' }; my regex b { 'boop' }; print 'beepboop' ~~ /<a><b>/; 23:45
camelia beepboop
leont No I mean I literally have an array with regexp objects, and I want to make them one regexp
Preferably without having to eval stuff
23:46 Doc_Holliwould left
leont Currently I'm doing this: sub join-regex(@terms) { my $base = ''; for @terms -> $term { $base = rx/$base$term/; } return $base;} 23:47
Doesn't appear to work, and calling dd on such a regexp just gives me «rx/$base$term/», which doesn't help me figure out what's going wrong
moon-child m: my @regecide = /beep/, /boop/; print 'beepboop' ~~ @regecide.reduce(-> $x, $y { /$x$y/ }) 23:48
camelia beepboop
leont Of course, reduce 23:49
moon-child which being said, I don't see why your solution wouldn't work 23:50
perhaps $base should be initialized to //
/''/ rather
23:51 xinming left 23:53 xinming joined
aukkras p6: say <1 2 3>.map(-> $x {$x <=> 2}); 23:54
camelia (Less Same More)
aukkras is there more concise way to do the above ? something like: say <1 2 3> <=> 2;
moon-child m: print <1 2 3> «<=>» 2 23:56
camelia Less Same More
moon-child »<=>» is better, actually
and you can use << and >> in place of « and » 23:57
aukkras ok, thanks
is <<<=>>> a concatenation of few operators ? <<, <=> and >> ? 23:58
superspaceship operator :) 23:59
moon-child it's the « » hyperoperator
or » »
docs.raku.org/language/operators#H..._operators
aukkras thanks again :)