🦋 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.
Eddward m: 3**2 01:44
camelia WARNINGS for <tmp>:
Useless use of "**" in expression "3**2" in sink context (line 1)
Eddward m: day 3**2
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
day used at line 1. Did you mean 'say'?
Eddward m: say 3**2
camelia 9
Eddward m: say [1, {$_*2} ... 10]
camelia MoarVM panic: Memory allocation failed; could not allocate 1355392 bytes
Eddward m: say [1, { $_ * 2 } ... 10]
camelia MoarVM panic: Memory allocation failed; could not allocate 1355392 bytes
Eddward 5, { $_ * 2 } ... 40 01:45
m: say 5, { $_ * 2 } ... 40
camelia (5 10 20 40)
Eddward m: say [ 5, { $_ * 2 } ... 40 ]
camelia [5 10 20 40]
Eddward m: say [ 5, { $_ * 2 } ... 10 ]
camelia [5 10]
Eddward m: say [ 1, { ($_+1) * 2 } ... 10 ] 01:46
camelia [1 4 10]
Eddward m: say [ 1, { ($_+1) ** ($_+1) } ... 10 ]
camelia (timeout) 01:47
gfldex m: my &min-prime = -> $_, *%_ { .first(&is-prime, |%_) }; say min-prime [10..42], :end; 02:47
camelia 41
gfldex codesections: ^^^
codesections gfldex, yeah, I know. Or even better with &first instead of .first:my &min-prime = -> |c {first(&is-prime, |c)}; say min-prime [10..42], :end 04:16
m: my &min-prime = -> |c {first(&is-prime, |c)}; say min-prime [10..42], :end
camelia 41
codesections but, still, that's not quite as nice as Whatever currying 04:17
(imo)
m: my &min-prime = &first ∘ ->|c {\(&is-prime, |c)}; say min-prime [10..42], :end # also works, and a bit clearer (again, imo) 04:19
camelia 41
immediate I make typos and pass unwanted named arguments to methods. Because of `%_` I don't get errors as I would with a subroutine. I write `die "..." if %_` to the beginnings of each method. Is there a way I can automate this for each method defined in a class 11:08
gfldex immediate: raku.land/github:nxadm/StrictNamedArguments 12:47
immediate oh thanks a lot 12:49
holyghost immediate, as gfldex says, I only use them in my sub method BUILD. Didn't understand your question. 12:54
holyghost I am on vacation tomorrow, I am going to make some AI agent system out of my module AI-Agent, probably client-serverwise 12:57
So you can send out intelligent agents from phone to phone for example
The sky's the limit :-)
So one just automates searches of agents on your phone and invites them etc without use input then you get e.g. mails/messages what others have of freeware or music (e.g. from your friends) etc 12:59
S/use/user/
The system should be fully automated
AI as if it were
phogg this works as expected: my $s = "<[ of ]>"; "foolish".match(/ ^ <$s> + /); but... 13:00
m: my $s = "of"; "foolish".match(/ ^ <[ <$s> ]> + /)
camelia ( no output )
holyghost I guess there's raku for android/iPhone/nokias. Needs e.g. a binary which can be run as a server or client
phogg where am I going wrong here? 13:01
MasterDuke you can't interpolate into character classes
phogg I noticed. Supposing I want to, how can I get around that? 13:02
I can dump my chars into a string "<[ $s ]>" first, but then they are not escaped properly
MasterDuke you'd have to build the regex and then EVAL it
phogg Makes sense. 13:03
Anton Antonov @holyghost I am using Raku to translate natural language specifications of computational workflows into executable code (mostly R and Mathematica, sometimes Raku and Python.) I assume I should be able to hook up that to the AI-Agent client-server idea you describe? 13:38
@holyghost Or maybe your AI-Agent framework is more "specialized", for some industry standard agents, say, from gaming? 13:40
holyghost It can be used for all of that, yes 13:41
OO and AI generally
OO <-> OOP
It was brought to me for making actor-objects in Scheme and LISP (without CLOS) 13:42
Anton Antonov @holyghost I looked into the AI-Agent GitHub repositories — I think more explanations and/or links are needed.(Sorry, if that seems too negative of a feedback…) 13:54
holyghost I will take care of it next week, I am going to do real AI agents with it then 13:56
Should be easy enough
holyghost discord-raku-bot, take a look at : scsh.net/resources/sunterlib.html, there's the same things programmed in Scheme in some of the packages 13:58
Anton Antonov @holyghost Sounds good, thanks! 13:59
codesections m: my $s = "of"; say "foolish".match(/ ^ <{"<[ $s ]>"}> + /) 14:19
camelia 「foo」 14:20
codesections phogg ^^^ I think that might do what you want
see docs.raku.org/language/regexes#Reg...erpolation
Anton Antonov @codesections You might be interested to see this Raku package `ML::TriesWithFrequencies` : github.com/antononcube/Raku-ML-Tri...requencies . 14:22
phogg codesections: seems to work! 14:24
Anton Antonov @codesection This is a great read: news.perlfoundation.org/post/grant...s_for_raku 14:30
phogg codesections: it's not quite perfect, though. I still need to escape each char of $s to avoid breaking on e.g. $s = ']>'; Still nicer than EVAL. 14:31
codesections phogg, good point. Here's a different approach with slightly different semantics: 14:41
m: my $s = "of]"; say "foolish".match(/ ^ @($s.comb) + /)
camelia 「foo」
codesections It uses docs.raku.org/language/regexes#Quo...TM_matches and gets the same result in these cases, but technically expands to /^ [ o | f | ']' ]+ / 14:43
instead of /^ <[of\]]>+ /
phogg I don't think that matters 14:53