🦋 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: ... | Logs can be inspected at colabti.org/irclogger/irclogger_log/raku Set by lizmat on 1 May 2021. |
|||
00:00
sno left
00:02
reportable6 left,
reportable6 joined
00:21
sno joined
00:27
parabolize left
00:28
sno left
00:29
parabolize joined
00:31
sno joined
00:37
sno left
00:59
DiffieHellman left
01:00
DiffieHellman joined
01:04
sno joined
01:10
sno left
01:12
DiffieHellman left
01:13
DiffieHellman joined
01:19
sno joined
01:23
sno left
01:29
sno joined
01:33
sno left
01:35
sno joined
01:41
sno left
01:49
kvw_5_ left
01:51
kvw_5 joined
01:53
sno joined
01:59
sno left
02:02
sno joined
02:08
sno left
02:11
titsuki joined
02:14
sno joined
02:16
kurahaupo left,
dataangel left
02:18
sno left
02:28
kurahaupo joined
02:31
Geth joined
02:35
geth_ left
02:48
kurahaupo_ joined,
kurahaupo left
02:50
kurahaupo_ left
02:51
kurahaupo joined
02:58
kurahaupo_ joined
03:02
kurahaupo left
03:03
kurahaupo_ left
03:04
kurahaupo joined
03:05
gabiruh left,
gabiruh joined
03:32
tejr left
03:37
tejr joined
|
|||
kybr | m: my $graph = -> $out, $freq = 440, $dur = 0.5, $amp = 0.6 { }; | 03:48 | |
camelia | ( no output ) | ||
kybr | Comma CT gives me a sort of linting warning: Cannot put positional parameter $dur after an optional parameter | 03:49 | |
this seems reasonable, but i'm curious why i don't get the warning when executing a script. | |||
also, Comma has really gotten better. yay! | 03:51 | ||
04:16
dotdotdot left
04:20
rindolf joined
04:23
dotdotdot joined
04:36
kurahaupo_ joined
04:37
kurahaupo left,
kurahaupo_ left
04:38
kurahaupo joined
04:47
kurahaupo left
04:58
[Sno] joined
05:07
geth_ joined
05:11
Geth left
05:12
ufobat joined
05:13
parabolize left
05:54
ufobat left
06:02
reportable6 left
06:03
reportable6 joined
06:32
aindilis` left,
wl20 left
06:33
wl20 joined,
ufobat joined
06:34
[Sno] left
06:46
domidumont joined
06:50
nn joined,
nn left
06:53
domidumont left
06:54
Sgeo left
06:55
brtastic joined
06:56
stoned75 left
07:06
stoned75 joined
07:07
domidumont joined
07:19
pecastro joined
07:23
wamba joined
07:32
wamba left,
wamba joined,
wl20 left
07:34
wl20 joined
07:37
samcv left
07:42
samcv joined,
asymptotically joined
08:38
geth_ left
|
|||
xinming_ | Is there a built-in function to recursively process a hash/array? | 08:41 | |
I'm trying to change all hypen in the hash keys so the generated json can be useful to old codes. :-) | 08:42 | ||
moritz | there's deepmap, dunno if that helps you | 08:43 | |
08:56
Geth joined
09:00
draco100[m] left
09:11
LizBot joined
|
|||
xinming_ | thx, Will check it | 09:20 | |
hmm, deepmap doesn't work on keys, I'll have to write one myself | 09:21 | ||
09:26
spacekookie left
09:27
spacekookie joined
|
|||
lizmat | xinming_ : if you are sure there will be no collisions between keys and values | 09:32 | |
you could maybe do something like: | |||
my %ap{Any} = %hash.antipairs; my %changed = %ap.deepmap: { }; my %result = %changed.antipairs ? | 09:34 | ||
meh, won't work with recursion, sorry for the noise | |||
09:53
rindolf left
|
|||
moritz | gist.github.com/moritz/8ab4e598ec7...3efe4fc44f | 09:54 | |
09:57
rindolf joined,
Black_Ribbon left
|
|||
xinming_ | moritz: thx, Actually, I have another version I wrote, but not generic as your version. | 10:02 | |
moritz: termbin.com/j7jf | 10:03 | ||
Mine | |||
BTW, are there any differences between .list vs .List ? | 10:04 | ||
leont | Sometimes, yes | 10:07 | |
10:08
wamba left
|
|||
leont | The former returns a Positional, it doesn't have to be a List | 10:09 | |
xinming_ | leont: could you please illustrate? I know .List is convert the Positional to a List using type object, but what does the .list do then? | ||
leont | Most of the time they do the same though | ||
E.g. Array.list returns itself, but Array.List returns a new list | 10:10 | ||
10:23
sno joined,
wamba joined
10:28
Shaeto joined
|
|||
Shaeto | is it correct chat for general raku programming questions? | 10:31 | |
lizmat | yes | 10:34 | |
Shaeto | thank you :) Q: i use prototyped grammar token, is it possible to add ONE action handler for all proto :sym< > variants ? | 10:35 | |
lizmat | moritz ^^ | 10:38 | |
Shaeto | for example i have "test:sym<A> test:sym<B> etc tests" and want to process all matches using one action method | 10:39 | |
method test ($/) does not work | 10:40 | ||
10:53
linkable6 left
|
|||
moritz | Shaeto: I don't think so | 10:53 | |
10:54
linkable6 joined
11:07
sno left
11:09
stoned75 left,
spacekookie left
11:10
spacekookie joined
11:11
sno joined
11:19
sno left
|
|||
Shaeto | thank you moritz | 11:21 | |
11:24
rindolf left
11:35
stoned75 joined
11:38
sno joined
11:48
sno left
11:50
wamba left,
wamba joined
11:53
sno joined
11:57
Kaiepi left,
Kaiepi joined
12:02
reportable6 left
12:04
reportable6 joined,
sno left
12:12
parv left
12:21
Anton joined
|
|||
Anton | Hi! I would like to generate sentences from Raku grammars. I have seen a video and a slide deck by Jonathan Worthington on the subject (titled "What if....Perl 6 Grammars could Generate?"), but they are from 7-8 years ago. Searches with Google did not produce links to other relevant work. Maybe there are some other / new efforts for that problem | 12:34 | |
people in this forum know about? | |||
sena_kun | Anton, hi. There was such an initiative back then, I think, but it was less relevant for recent years and so was not developed actively. | 12:36 | |
Anton | sena_kun Ok, thanks! | 12:37 | |
moritz | maybe be easier after the RakuAST rework is finished | 12:38 | |
12:38
Gruber is now known as Grrrr
|
|||
Anton | moritz I was just going to ask about using AST! :) | 12:38 | |
moritz quicker :D | 12:40 | ||
Anton | I think that, in principle, I should be able to "traverse" the methods/rules of the grammar objects and pick a random rule branches. Is this viable and easy enough? | 12:41 | |
moritz | once you can introspect your regexes sufficiently, yes | ||
of course you also need to consider character classes | |||
and quantifiers | |||
Anton | So, to be clear, right now there is no sufficient regex introspection? | 12:45 | |
moritz | at least I wouldn't be aware of how to do it | ||
Anton | @moritz Ok, thanks! You opinion to means that I should stay away from doing this in Raku for awhile... (I assume you are the author of the book "Parsing with Perl 6 Regexes and Grammars".) | 12:48 | |
moritz | you assume correctly | ||
12:48
titsuki left
|
|||
Anton | :) Ok. Great book -- very instructive! | 12:48 | |
moritz | thanks, glad you liked it | 12:49 | |
in fact, it's the book I'm most proud of (and which has the lowest sell count of any of my books :D) | |||
Anton | Hmm... I do think the subject matter is great, but most people / developers are not that interested in subject. | 12:50 | |
*The subject matter of the book... | 12:52 | ||
@moritz I would like to ask about a different type of work you did : ODE solvers. Do you plan to resume your work on this package? github.com/moritz/Math-Model | 12:53 | ||
moritz | Anton: not really, I consider that thing feature complete | 12:54 | |
Anton | Ok, good to know! | 12:55 | |
moritz | though if you would like to take it over, and expand it (maybe plug in different integrators?), I'd be open to such an idea | ||
Anton | @moritz Yes, I think that would be interesting. I would like Raku packages to do, say, epidemiological simulations. | 12:56 | |
Also, I plan to write a numerical integration framework in Raku. Please see: github.com/antononcube/Raku-Math-NIntegrate | |||
moritz | looks interesting | 12:58 | |
Anton | @moritz Thanks! Please take a look in this Raku package that generates monadic pipelines for epidemiological simulations: github.com/antononcube/Raku-DSL-En...gWorkflows . Right now I hook that Raku package outcomes in R and Mathematica. As I said, I would to use ODE solvers in Raku. | 13:01 | |
*I would like to... | 13:03 | ||
13:22
Anton left
13:32
sno joined
13:35
titsuki joined
13:45
b2gills left
14:08
mowcat joined
14:33
wamba left
14:35
ufobat_ joined
14:38
ufobat left
14:44
Shaeto left
14:46
domidumont left
14:47
domidumont joined,
Sgeo joined
14:53
rindolf joined
15:00
brtastic left
15:09
b2gills joined
15:11
rindolf left
15:14
jmerelo joined,
domidumont left
15:30
lucasb joined
15:33
sno left
15:49
patrickb joined
|
|||
patrickb | bisectable: "abcdefg".subst( / ( cde ) /, { say $0.encode.decode } ); | 15:49 | |
bisectable6 | patrickb, Will bisect the whole range automagically because no endpoints were provided, hang tight | ||
patrickb, Output on all releases: gist.github.com/1535d580ef0ea5711f...554fb5598f | |||
patrickb, Bisecting by exit code (old=2021.03 new=2021.04). Old exit code: 1 | |||
patrickb, bisect log: gist.github.com/36be05e7a27269cf6c...e1fa4d02f1 | 15:50 | ||
patrickb, (2021-04-11) github.com/rakudo/rakudo/commit/57...121a64d99d | |||
patrickb, Bisecting by output (old=2016.09 new=2016.10) because on both starting points the exit code is 1 | |||
patrickb, bisect log: gist.github.com/b3077eca7df1fb4522...e403951af2 | |||
patrickb, (2016-09-27) github.com/rakudo/rakudo/commit/22...0f14b9c05c | |||
patrickb, Output on all releases and bisected commits: gist.github.com/45cabf1aa8e08062e3...3dcbc363dd | |||
patrickb | bisectable: "abcdefg".subst( / ( cde ) /, { say $0.Str.encode.decode } ); | 15:51 | |
bisectable6 | patrickb, Will bisect the whole range automagically because no endpoints were provided, hang tight | ||
patrickb, ¦6c (53 commits): «cde» | |||
patrickb, Nothing to bisect! | |||
15:59
patrickb left,
asymptotically left
16:04
rindolf joined
16:53
aluaces left
17:00
sno joined
17:26
aluaces joined
17:33
wl20 left
17:34
wl20 joined
17:55
jmerelo left
18:02
reportable6 left
18:03
reportable6 joined
18:20
kurahaupo joined
18:37
aindilis joined
18:40
brtastic joined
18:48
maggotbrain left,
maggotbrain joined
18:51
maggotbrain left
18:53
maggotbrain joined
19:02
titsuki left
19:11
Black_Ribbon joined
19:17
ufobat_ left
19:25
wamba joined
19:33
wl20 left
19:35
wl20 joined
19:53
Shaeto joined
|
|||
Shaeto | can't find info how to call parent method, in p5 i use $self->SUPER:: what about raku ? | 19:55 | |
lizmat | nextsame callsame | 19:57 | |
or specifically: $foo.Bar::methodname | |||
Shaeto | thank you! | 19:59 | |
codesections | and the relevant doc are at docs.raku.org/language/functions#Re-dispatching | ||
s/doc/docs/ | |||
Shaeto | i tried to read objects inheritance docs | ||
20:03
xelxebar_ joined,
xelxebar left
|
|||
codesections | Are set operations _supposed_ to exclude falsy values? | 20:19 | |
m: say Map.new((:foo(0), :bar(''), baz(1))) (-) Map.new((:qux(2))) | 20:20 | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Undeclared routine: baz used at line 1. Did you mean 'bag'? |
||
codesections | m: say Map.new((:foo(0), :bar(''), :baz(1))) (-) Map.new((:qux(2))) | 20:21 | |
camelia | Set(baz) | ||
codesections | I found/find ^^^^ *very* surprising. Is it buggy, or am I just confused? | ||
hmmm, the following seems inconsistent, which makes me think the above might be a bug | 20:24 | ||
m: say ('', 0, 1) (-) (2) | 20:25 | ||
camelia | Set( 0 1) | ||
raydiak | it is documented: second paragraph and following example at docs.raku.org/type/Set#Creating_Set_objects | 20:49 | |
20:50
Shaeto left
|
|||
raydiak | see also the table at the bottom of the introduction at docs.raku.org/language/setbagmix which I'd assume is the justification for such behavior | 20:54 | |
codesections | raydiak: thanks. That's interesting, and might be worth noting in the (-) docs [I might do so, actually] | 20:58 | |
I don't really see how the table in setbagmix provides a justification, though? | 20:59 | ||
from that table, I might expect Map.new((:foo(''), :bar)) (-) Map.new((:bar)) to return Set.new(:foo(0)), but I wouldn't expect the empty set | 21:02 | ||
(Not arguing -- the other page you linked is clear that it's intentional. I'm just still confused) | |||
raydiak | so anything in a Set which :exists is True | 21:03 | |
codesections | m: say Map.new((:foo(0)))<foo>:exists | 21:05 | |
camelia | True | ||
raydiak | so when coercing the Map to a Set, it's calling .Bool on each value and doing what makes sense to a Set with that - throwing away the false things because they aren't in the set, according to set semantics | ||
yes I agree it feels to me like we're confusing truthiness with existence to some extent | |||
codesections | m: say (0, '').Set | 21:06 | |
camelia | Set( 0) | ||
codesections | m: say (0, False, 1).Set | ||
camelia | Set(0 1 False) | ||
codesections | m: say (0, False, 1, :p(0)).Set | 21:07 | |
camelia | Set(0 1 False) | ||
codesections | ^^^ I think it is something to do specifically with the slightly odd smartmatching for Pair | 21:08 | |
(not unjustified -- it powers some cool features. But, still, it still seems a bit odd) | 21:09 | ||
raydiak | keys of any sort are allowed. it's the truthiness of the *value* that matters, which only exists when you're converting from a map-like thing or a pair or pairlist | ||
look at how bag and mix work...if something drops to zero, it's not in the collection any more. so I guess someone thought "Sets should work just like that but under Bool instead of Int or Real" | 21:10 | ||
codesections | ohh, thanks, that's a helpful way of putting it | 21:11 | |
re: someone thinking that -- maybe. But I also think it falls naturally out of the Pair smartmatch symantics | 21:12 | ||
tonyo | this is the relevant code: github.com/rakudo/rakudo/blob/mast...h.pm6#L392 | 21:13 | |
codesections | agreed, that or maybe the method right below it SUB-PAIRS-FROM-SET, which notes that it uses Pair semantics | 21:15 | |
(aka, the semantics that mean :bar(42) ~~ :foo(42) returns True) | 21:16 | ||
21:33
neshpion joined
21:34
wl20 left
21:35
wl20 joined
21:40
MasterDuke joined
21:49
mowcat left
22:10
wamba left
22:36
oddp joined
|
|||
oddp | This works: say slurp.chomp.comb.map(...); now, if i wanna break that chain up and insert a newline after slurp, the whole thing breaks. Why's is calling slurp and not considering the .chomp... on the next line? thought we had semicolons just for that? | 22:40 | |
gives: "No such method 'chomp' for invocant of type 'Any'" | 22:41 | ||
22:42
parv joined
|
|||
oddp | slurp() looks a bit ugly, but i guess i have to go with that for now | 22:42 | |
22:42
parabolize joined
|
|||
codesections | oddp: it's actually not the newline specifically -- it's any whitespace (because foo.method and foo .method have different precedence). I'm pretty sure you can do `slurp\ .chomp`, though | 22:47 | |
m: say -1.abs; say -1 .abs; say -1\ .abs | 22:48 | ||
camelia | -1 1 -1 |
||
moon-child | I think \ is even uglier than () :P | 22:49 | |
codesections | :D fair. | ||
oddp | and why are both slurp().chomp and slurp() .chomp working then? | ||
kybr | m: class Foo { has $!sig = :($x = 1, $y = 1); method foo($!sig) {} } | 22:50 | |
camelia | ===SORRY!=== QAST::Block with cuid 1 has not appeared |
||
MasterDuke | kybr: interpolating a signature bound to/stored in a variable as the signature for a sub/method is not (currently at least) possible | 22:52 | |
kybr | MasterDuke: thanks. | 22:54 | |
maybe i'll generate some code then. | 22:55 | ||
codesections | oddp: I'm not 100% sure of the details, but it's caused by the fact that &infix:<.> (the one with a space) has lower precedence than the .method call, and that means that `slurp .chomp` is parsed as `slurp(Any.chomp)` -- which isn't possible with slurp() .chomp or slurp.chomp | 22:57 | |
MasterDuke | github.com/rakudo/rakudo/issues/3786 and github.com/rakudo/rakudo/issues/1301 are related to the QAST::Block and cuid error | 22:58 | |
oddp | `slurp(Any.chomp)` -- hm, interesting. alright, thanks for your input! | 23:00 | |
23:17
pecastro left
23:48
brtastic left
|