🦋 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:08 reportable6 left 00:10 reportable6 joined 00:11 ajr_ left 00:19 linkable6 joined 00:42 jjido left 00:57 lainon joined 01:01 solitario left 01:04 solitario joined 01:46 lainon left 02:29 Guest3959 left 02:34 epony joined 02:39 frost joined 03:01 frost left 04:01 linkable6 left, reportable6 left, sourceable6 left, notable6 left, nativecallable6 left, bisectable6 left, greppable6 left, releasable6 left, tellable6 left, evalable6 left, squashable6 left, coverable6 left, quotable6 left, unicodable6 left, statisfiable6 left, benchable6 left, committable6 left, bloatable6 left, shareable6 left 04:02 tellable6 joined, statisfiable6 joined 04:03 benchable6 joined, nativecallable6 joined 04:04 greppable6 joined 04:46 jaguart joined 04:58 jaguart left 05:02 linkable6 joined 05:04 committable6 joined, releasable6 joined, unicodable6 joined, squashable6 joined 05:05 shareable6 joined 05:26 frost joined 05:31 Garbanzo__ joined 05:42 frost left 05:43 Darkcoal joined 05:49 Darkcoal left 05:57 Darkcoal joined 06:02 sourceable6 joined, quotable6 joined 06:04 bloatable6 joined 06:10 solitario left 06:12 Darkcoal left 06:14 Darkcoal joined 06:19 solitario joined, clarjon1 joined 06:50 Garbanzo__ left 07:03 coverable6 joined, evalable6 joined 07:04 bisectable6 joined 07:05 reportable6 joined 07:19 lgtaube left 07:21 lgtaube joined 07:22 abraxxa joined, jjido joined 07:25 camelia left, zostay left, Sgeo left, vrurg left, swaggboi left, japhb left, guifa left, kjp left, timo left, maettu left, merpader1 left, perlmaros left, ilogger2 left, tinita left, phogg left 07:26 abraxxa left 07:27 mahafyi joined 07:28 Sgeo joined, vrurg joined, swaggboi joined, japhb joined, guifa joined, kjp joined, timo joined, maettu joined, merpader1 joined, perlmaros joined, ilogger2 joined, tinita joined, phogg joined, camelia joined, zostay joined 07:42 abraxxa joined 08:24 jjido left 08:28 Sgeo left, [Coke] left 08:31 [Coke] joined 08:54 jjido joined 08:58 abraxxa left 09:00 abraxxa joined 09:03 notable6 joined 09:07 dakkar joined 09:25 jjido left 09:49 mahafyi left 10:19 lichtkind_ joined 10:28 lichtkind__ joined 10:31 lichtkind_ left 11:42 jjido joined 12:07 reportable6 left 12:09 reportable6 joined 13:09 linkable6 left, evalable6 left 13:35 simcop2387 joined 13:36 perlbot joined 13:40 lockywolf left 13:42 lockywolf joined 14:06 raiph joined
raiph r: say do for ^10 { .say; last 99 if $_ > 3 } 14:07
camelia ===SORRY!=== Error while compiling <tmp>
Calling last(Int) will never work with any of these multi signatures:
( --> Nil)
(Label:D $x --> Nil)
at <tmp>:1
------> say do for ^10 { .say; ⏏last 99 if $_ > 3 }
Can't open perl script "/home/camelia/rakudo-j-inst/bin/eval-client.pl": No such file or directory
14:10 linkable6 joined 14:12 raiph left
lizmat m: use v6.c; say do for ^10 { .say; last 99 if $_ > 3 } 14:21
camelia ===SORRY!=== Error while compiling <tmp>
Calling last(Int) will never work with any of these multi signatures:
( --> Nil)
(Label:D $x --> Nil)
at <tmp>:1
------> use v6.c; say do for ^10 { .say; ⏏last 99 if $_ > 3 }
lizmat m: use v6.*; say do for ^10 { .say; last 99 if $_ > 3 }
camelia 0
1
2
3
4
(99)
14:35 jjido left 15:02 Sgeo joined 15:36 abraxxa left 15:38 abraxxa joined 16:09 evalable6 joined 16:47 ph88 joined
ph88 hey guys, is it possible to change inputs to a function like it was a pointer ? 16:48
so after function call is done the input argument value was changed 16:50
lizmat m: sub foo($a is raw) { $a = 42 }; my $b = 666; foo $b; say $b 16:51
camelia 42
lizmat ph88 something like that ^^ ?
ph88 lizmat, yes that looks very good ! .. so the trick is in "is raw" ? 16:56
lizmat yes, if you're sure it is a single item that you're interested in
m: sub foo(\a) { a = 42 }; my $b = 666; foo $b; say $b # slightly different semantics 16:57
camelia 42
ph88 lizmat, do you know if it's possible to return multiple arguments ? 16:58
lizmat Raku only ever returns a *single* value
ph88 ok
16:58 jjido joined
lizmat *BUT* that value can be a List or an Array :-) 16:58
ph88 sure 16:59
is there a good library for reading raku source code into syntax tree ?
lizmat m: sub foo() { (42,666) }; my ($a,$b) = foo; say $a; say $b
camelia 42
666
lizmat src/Perl6/Grammar.nqp :-) 17:00
there have been several modules trying to do that
raku.land/github:raku-community-mo...l6::Parser would be one of them
ph88 is it good ?
lizmat alas, the author is no longer with us :-( 17:01
ph88 he died ?
lizmat yeah :-(
ph88 awww
no syntax highlighting on raku land website o_O
lizmat rakudoweekly.blog/2020/03/16/2020-...od-friend/ 17:02
ph88 ill read that
i heard raku has good grammar feature .. does that automatically yield a parser and printer ?
only 50 years 17:03
lizmat docs.raku.org/language/grammar_tutorial
yeah, way too early :-(
ph88 lizmat, thanks for the link .. though i don't see something about printer there 17:04
lizmat I'm not sure what you mean with "printer" ?
ph88 a function that takes a syntax tree and outputs a string of source code 17:06
17:12 djerius left
ph88 lizmat, ^ 17:13
17:14 djerius joined 17:18 abraxxa left 17:23 dakkar left 17:28 lichtkind__ left
ph88 what's the difference between raku.org and rake.land ? 17:30
lizmat raku.land shows the modules that you can download for Raku programs
raku.org is the main website for the Raku Programming Language 17:31
Nemokosch raku.land is a comprehension of modules
guifa ph88: all you'd need to do is create a .Str method for each element of a your syntax tree. The complexity of it would be based on how pretty you want the output to be. 17:45
For instance, the upcoming RakuAST feature gives each node a DEPARSE method, that produces Raku source code from the syntax tree. I've got a module Pretty::RAST that works similarly, but tries to give colored highlighting, etc too (though mine doesn't provide complete coverage of all nodes yet) 17:46
lizmat guifa: please note that the DEPARSE method is only guaranteed to produce a string that will re-create the given node, *not* the code that was originally used! 17:54
guifa lizmat indeed — I'm guessing it was designed mainly for why i made Pretty::RAST: much faster visualization of what's going on than reading a massive list of node names 18:04
18:08 reportable6 left, jjido left, reportable6 joined
guifa can envision the python people "you mean you don't have one syntax for one parse tree and vice versa? the horror!" as we all smile and let out a maniacal laugh 18:14
18:38 xinming left
ph88 thanks guys 18:39
18:40 xinming joined 18:41 dextercd joined
qorg11 What happened to p6doc? 19:02
El_Che rakudoc 19:07
Nemokosch something got added 19:19
raku.land/github:Raku/p6doc
19:29 jjido joined 19:38 abraxxa-home joined 19:55 jjkklll joined 20:09 jjkklll left 20:12 abraxxa-home left 21:03 Xliff joined 21:09 squashable6 left 21:33 Darkcoal left 21:45 libbits joined 21:51 libbits left
Xliff m: class A { method a { 1 }; method b { 2 }; method c { 3 }; }; class B { has A $!a handles /\ 21:53
camelia ===SORRY!===
Unrecognized regex metacharacter \ (must be quoted to match literally)
at <tmp>:1
------> { 3 }; }; class B { has A $!a handles /\⏏<EOL>
Regex not terminated.
at <tmp>:1
------> { 3 }; }; class B { has A $!a h…
Xliff m: class A { method a { 1 }; method b { 2 }; method c { 3 }; }; class B { has A $!a handles /\w+<?{ $/.Str ne 'c' }>/ = A.new; method a { 'a' }; method b { 'b' }; }; 21:54
camelia ( no output )
Xliff m: class A { method a { 1 }; method b { 2 }; method c { 3 }; }; class B { has A $!a handles /\w+<?{ $/.Str ne 'c' }>/ = A.new; method a { 'a' }; method b { 'b' }; }; A.new.c.say; B.new.a.say; B.new.c.say; 21:55
camelia 3
No such method 'c' for invocant of type 'B'. Did you mean any of
these: 'a', 'b'?
in block <unit> at <tmp> line 1

a
Xliff m: class A { method a { 1 }; method b { 2 }; method c { 3 }; }; class B { has A $!a handles /\w+<?{ $/.Str ne 'c' }>/ = A.new; method c { 'c' }; }; A.new.c.say; B.new.a.say; B.new.c.say;
camelia 3
1
c
Xliff Nice!
Is there a faster way to do that bit of delegation without the regex?
vrurg Xliff: pre-build a list of methods at compile time? 22:07
22:12 squashable6 joined
Util m: class A { method a { 1 }; method b { 2 }; method c { 3 }; }; class B { has A $!a handles * = A.new; method c { 'c' }; }; 22:13
camelia ( no output )
Util m: class A { method a { 1 }; method b { 2 }; method c { 3 }; }; class B { has A $!a handles * = A.new; method c { 'c' }; }; A.new.c.say; B.new.a.say; B.new.c.say;
camelia 3
1
c
Util Xliff: Delegate everything, and any explicit methods of the B class override the delegation.
Xliff Util: Ah. OK. 22:19
Util m: my @subs = sub {$^a + $^b}, (* + *), &[+], sub {$^a ~ $^b}, (* ~ *), &[~]; for @subs -> &s { say (0, 1, &s ... *).head(5) }
camelia (0 1 1 2 3)
(0 1 1 2 3)
(0 1 1 2 3)
(0 1 01 101 01101)
(0 1 01 101 01101)
(0 1 01 0101 01010101)
Util I expect output lines 1,2,3 to be identical, which they are.
I expect output lines 4,5,6 to be identical, but 6 differs from 4&5. Why?
22:29 jjido left 22:47 jjido joined, jjido left 23:01 dextercd left
elcaro Util: my instinct is it would be some kind of confusion with arity/count 23:06
just had a quick look, `&[+].count ~~ 2`, but `&[~].count ~~ Inf`... so that's odd 23:08
maybe something to do with it
m: say (sub {$^a + $^b}, (* + *), &[+], sub {$^a ~ $^b}, (* ~ *), &[~])».count 23:10
camelia (2 2 2 2 2 Inf)
elcaro dunno why the concat infix needs infinite arity 23:12
m: say &infix:<~>(< foo bar baz >)
camelia foobarbaz
[Coke] waves 23:15
elcaro so your sequence with &[~] is actually slurping all previous vals.
m: (0, 1, -> *@a { [~] @a } ... *).head(5) # essentially
camelia ( no output )
elcaro m: say (0, 1, -> *@a { [~] @a } ... *).head(5) # essentially
camelia (0 1 01 0101 01010101)
23:15 swaggboi left
elcaro I've used a slurpy param on a sequence before to do dynamic programming... been meaning to write a post on it. 23:16
23:28 swaggboi joined