🦋 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.
guifa how does one use the MOP to create a role? AFAICT this should work 02:53
my \Foo := Metamodel::ParametricRoleHOW.new_type(name => "Foo"); Foo.^add_method("foo", { "called foo" } ); class Bar { }; my $x = Bar.new; $x does Foo; say $x.foo; 02:55
bu it bombs with Language revision must be a concrete string
msudx hello 07:44
can someone answer my questions 07:47
spacekookie Is there some way to turn a list of hashes into a hash with the key and values being determined from each hash in the list? 11:09
Like [ { key => a, val => b} { key => c, val => d }] ---> { a => b, c => d } 11:10
moon-child m: say [{key => 'a', val => 'b'}, {key => 'c', val => 'd'}].map({$_<key> => $_<val>}).Hash 11:12
camelia {a => b, c => d}
moon-child spacekookie: ^ 11:12
spacekookie huh! I tried $<key> => $<val> but that didn't work. Is $_ special? 11:13
moon-child yes
docs.raku.org/syntax/$_ 11:14
spacekookie thanks!
moon-child you might also write -> $x { $x<key> => $x<val> }, or { $^x<key> => $^x<val> }, or sub ($x) { $x<key> => $x<val> }
in cases where you don't ever use a parameter more than one, you can use * (whatever star) and skip the braces 11:15
sooo many ways to write functions :P
holyghost Happy newyear, everyone 11:39
Anton Antonov @holyghost Happy New Year, to you too! 12:43
@moon-child Thanks for mentioning Cyc! 13:06
moon-child no problem 13:08
symbolic ai is not dead, just on its last elbows!
spacekookie moon-child: it's very strange because I could have sworn that my map(-> $x { $x<key> => $x<val> }, @list) produced an error along the lines that hashes couldn't be mapped. But I can't actually reproduce it anymore... 13:18
holyghost moon-child, inference engines are not dead :-) 13:19
moon-child as I said, on its last elbows only
(though logic programming is alive and well, at least; see z3, sql, kanren, et al) 13:20
holyghost rules/facts based learning may be old yes, from LISP days 13:21
You can represent more in LISP/Scheme that way 13:22
nine guifa: you're missing a bit: 13:57
m: my \Foo := Metamodel::ParametricRoleHOW.new_type(name => "Foo"); Foo.^add_method("foo", my method :: () { "called foo" } ); Foo.^set_body_block(-> |args {}); Foo.^compose; class Bar { }; Foo.new; my $x = Bar.new; $x does Foo; say $x.foo;
camelia called foo
guifa nine ty! I didn't realize that was required 13:58
nine m: my \Foo := Metamodel::ParametricRoleHOW.new_type(name => "Foo"); { Foo.^add_method("foo", my method foo () { "called foo" } ); Foo.^set_body_block(-> |args {}); }; Foo.^compose; class Bar { }; Foo.new; my $x = Bar.new; $x does Foo; say $x.foo; # probably better yet
camelia called foo
nine You definitely always have to call ^compose on them, before using synthetically created types. And methods really have to be methods 13:59
Anton Antonov My Wolfram Community post “Connecting Mathematica and Raku” was made a “Staff pick” this morning: community.wolfram.com/groups/-/m/t/2434981 . 14:34
Geth doc/master: 4 commits pushed by finanalyst++, (Richard Hainsworth)++ 15:11
guifa Anton++ 16:26
guifa nine: well, thanks for the help :-) Unfortunately, couldn't quite pull off what i was hoping for. Is there a way to create a multi sub via MOP? I see a MultiMethodHOW but not a MultiSubHOW 16:56
nine Everything can be created via the MOP, as that's what the compiler itself uses. It's just not always obvious what to do. 16:58
guifa err, yeah, sorry I haven't had my coffee yet this morning 16:59
nine Note that there is no MultiMethodHOW either. It's MultiMethodContainer - the role that e.g. a meta class does for supporting multi methods. Multi subs and multi methods themselves are just instances of a normal class.
gotta make dinner now 17:00
guifa ugexe tonyo1 over in #raku-beginners someone mentioned that zef search X is hanging sometimes. I was able to reproduce just now but it's sporadic. Any advice I can pass along / debugging I can do ? 17:06
ugexe you'd want to know if github.com/ugexe/zef/blob/7d6b48db...#L175-L177 is getting stuck searching one of the ecosystems 17:20
ugexe you can run i.e. 'raku -I. bin/zef search X --debug' if you add debugging statements, no need to keep reinstalling 17:26
i ran that 10 times without hanging, so i don't have much else to suggest
guifa ugexe if I can get it to do it again (it's only happened once for me) I'll see if I can track it down. Is there a way via command line to limit the search to specific ecosystems? 17:28
ugexe --/p6c --/cpan --/cached --/fez would disable all ecosystems 17:29
guifa ugexe++ 17:30
ugexe github.com/ugexe/zef/blob/7d6b48db...on#L25-L79 17:34
note this is an array of array
each inner array will be hyperd
so for a search the flow looks like [ [fez].hyper.search(...).Slip, [p6c, cpan].search(...), [cached].search(...).Slip ] 17:36
er, each of those .search should be .hyper.search
i mention because it might not necessarily be a specific ecosystem that is the issue, but e.g. waiting on multiple (the p6c + cpan one) 17:37
Geth doc: finanalyst++ created pull request #4006:
change run on config explanation to match actual behaviour
19:31