🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
ugexe tbrowder__: maybe run again with --update flag to force it to redownload the ecosystem json files 01:09
tellable6 2023-08-17T23:18:56Z #raku <tbrowder__> ugexe ^^^ any questions or suggestions?
ugexe or just run zef update
tbrowder__ nothing works yet. what is the best way to nuke my current zef and start with a clean slate? 01:36
could anything in ~/.raku be affecting it? 01:37
tonyo zef nuke
tbrowder__ my problem is no installed zef that works. can i, in zef rep, do: raku -I. bin/zef nuke"? 01:40
yay!!!! it saw drastic, but zef is working again! thanks, tony-o and ugexe! 01:44
*was 01:45
nite all
tonyo tbrowder__++ 04:30
lizmat moritz I wonder: is there a performance reason to use "rule" over a "token" ? 08:59
reason I'm asking: in the Raku grammar I'm seeing many rules that could be tokens and then can be made better readable 09:03
wayland76 Hi all. I have a Dockerfile which uses a raku image, and tries to install fez. The install of fez fails. Dockerfile and output at gist.github.com/wayland/6ea78e9cb2...6bf4571e74 09:48
Any thoughts as to whether there's anything I can do at my end to fix it?
lizmat wayland76: have you tried adding "--exclude="z"" ? 09:56
or install libz ?
RUN zef install fez --exclude="z" 09:57
wayland76 Oh! I haven't. OK, sounds like the basic problem is that I'm using a minimalist distro? :)
Btw, the key thing no-one mentioned in our discussion last week was that it's possible to use the new grammar now by going "use experimental :rakuast;" -- just for future reference next time someone has a question like mine :) . 09:59
wayland76 Ended up adding zlib-dev and curl, and it worked. Thanks lizmat! :) 10:11
lizmat wayland76: that is actually incorrect 10:22
use experimental :rakuast 10:23
only exposes the RakuAST classes
if you want code to be evaluated in a script, you must set RAKUDO_RAKUAST=1 before running raku
wayland76 Good to know; thanks! 10:24
lizmat if you want to evaluate code in a string with the Raku grammar, you can call the .AST method on the string
m: say Q|say "hello world"|.AST
camelia RakuAST::StatementList.new(
RakuAST::Statement::Expression.new(
expression => RakuAST::Call::Name.new(
name => RakuAST::Name.from-identifier("say"),
args => RakuAST::ArgList.new(
RakuAST::QuotedString.new(
lizmat m: say Q|say "hello world"|.AST.EVAL
camelia hello world
True
wayland76 Thanks! 10:25
wayland76 Question: Is there a plan to make operators work on the Supply objects (or something similar) so that we can join them together like chaining processes together in bash? 10:46
lizmat could you gist an example / pseudocode ? 11:01
wayland76 lizmat: Best I've got now is something like gist.github.com/wayland/826ba0604e...178bc35795 11:12
lizmat isn't that basically a react / whenever setup ?
wayland76 The idea is that the $machine= statement links everything together, and then the $machine.run sets it in an endless loop, where the various different supplies or whatever (read websocket, parse json, grep in the json for the word furniture, push into database) can run in parallel 11:13
lizmat that reads as a react whenever $web-socket { parse-json.grep(furniture).insert } to me ? 11:15
wayland76 From a simple processing POV, yes, but conceptually, not what I was after (and my example and possibly explanation are at fault here). The grep was an external process (and the point was the external process, not the actual grep -- the actual grep was a dumb idea). The points I'm trying to make, though, are a) we can have a network of explicitly independent modules that process data and pass to the next, and b) we can chain them together with operators. 11:29
What I was trying to achieve was more like having each "whenever" clause emit something from a supply, and then adding another whenever clause to read the next supply. However, I'm not keen on the amount of code involved, and would like to have a simple way to chain things together, but have them run in parallel.
lizmat I *think* you should be able to create a react with multiple whenevers each handling a separate stage, with one stage emitting onto the next 11:33
wayland76 Oh, agreed, it's entirely possible.
lizmat however, only one whenever runs at any time, so there goes your parallell excution idea
*execution
wayland76 I just wanted to simplify the whole thing with operators.
Oh, right.
lizmat now, feeds are supposed to parallelize, but they don't yet, afaik 11:34
docs.raku.org/language/operators#infix_==%3E 11:35
wayland76 I'm happy if things *don't* parallelise yet, I just want to set things up for when they do :) .
Also, if only one whenever can happen at a time, why is it on the concurrency page? :p 11:36
lizmat jnthn probably would have some ideas about that, because of Cro
from the whenever doc: 11:37
> Please note that one should keep the code inside the whenever as small as possible, as only one whenever block will be executed at any time. One can use a start block inside the whenever block to run longer running code.
so: 11:38
wayland76 Sounds sensible. My idea of chaining multiple whatevers with Supply.emit would enhance that :p
lizmat react whenever $socket { start { jsonify.grep.insert } }
wayland76 Is there somewhere I should take the idea to get it in front of jnthn? 11:39
lizmat good question :-) atm he's still on vacation afaik 11:49
wayland76 Hmm. If only one whenever runs at a time, then I should probably emphasise that that's why I want to use Supply-based objects (instead of react/whenever), so that they can indeed be run in parallel.
Oh, right! I'm in Australia, so that possibility hadn't even occurred to me. 11:50
And, as an extra bonus, I want each of these items based on a Supply to actually have /two/ supplies -- one for data going "downstream" (the default direction), and one for data going "upstream". This would be particularly useful for eg. a stream with a CSV encoder/decoder (?modem :p ), which would convert CSV to data one direction, and data to CSV the other direction. 11:53
wayland76 One more question: Would it be possible to add a method to Str (yes) with a name consisting of one Unicode symbol? I'm specifically looking at something like "CSV".⇺ 13:17
wayland76 Hmm. It appears not. Must start with a letter or underscore. Oh well. 13:46
wayland76 On the plus side, I think I've figured out how to do my entire Slang as operators, and two extra functions on Str. 13:54
lucs Test 14:36
scullucs test 14:37
lucs wayland76: Actually, the problem with '⇺' is that Raku identifiers must be composed only with characters of one of the Letter categories (Ll, Lm, Lo,Lt, Lu), but U-21FA has Unicode category "Math Symbol (Sm)". 14:45
gfldex m: Str.^add_method('⇺', method LAWDVS (|) { say 'well…'; }); Str.^can('⇺').say; "Yes, but should you?"."⇺"(); 15:10
camelia Potential difficulties:
Useless declaration of a has-scoped method in mainline (did you mean 'my method LAWDVS'?)
at <tmp>:1
------> Str.^add_method('⇺', method⏏ LAWDVS (|) { say 'well…'; }); Str.^can(
(LAWDVS)
well…
gfldex m: Str.^add_method('⇺', my method LAWDVS (|) { say 'well…'; }); Str.^can('⇺').say; "Yes, but should you?"."⇺"();
camelia (LAWDVS)
well…
gfldex wayland76: ^^^
lucs gfldex: Are you saying that a non-letter identifier can work? 15:11
gfldex Not without a proper slang.
lucs Ah, okay. Too complicated for me :)
(well, not that complicated, but still) 15:12
(thinking out loud) So yeah, here's it's not used as an identifier, but that mechanism allows using an arbitrary string. 15:14
tbrowder__ another zef question: is it expected in some cases when installing a module with a long and complicated dependency chain for it to fail partway but eventually work for, say, “zef install ComplicatedModule?” 16:20
i think there is a zef option to install each module as it is successfully tested. 16:21
ugexe if a long dependency chain installation fails, then it likely means one of those dependencies is not configured properly i.e. something isn't declaring a dependency it should but some other dependency does declare it, so after installing some dependencies the broken one "works" 16:48
whatever module it is failing on explicitly is probably the one that isn't configured properly
you can use --serial for zef to install them after each is tested, but really the broken module should be fixed 16:49
tbrowder__ agree, thanks 17:02
librasteve oh - yes ... glad you have replaced my bad answer ... TIL 17:27
tbrowder__ can some kind person with a moment to spare running linux (preferably debian) on an AMD mb try to "zef install Font::FreeType" (you'll have to have system dev libs for libfreetype and fontforge installed). my problem is the only debian host i have (out of 4 ) that's not capable of installing the module is my "new" AMD box. unless i have some other hardware problem, i want to eliminate the amd part. thanks so much. 19:39
tbrowder__ i'm running latest raku on all with all system updates good. 19:40
never mind, i just heard from the author (David Warring in Australia): he's running Deb 12 on an AMD. thanks anyway. 20:08
tonyo tbrowder__: installed fine for me on dual xeons 21:38
and opensuse
ope misread what you needed 21:39
su.shi when you interpolate a regex into a match, are capture groups not meant to be kept? 21:44
as in, I have the code my $re = /(.*?)\n/; my $str = "hello\nthere"; my $test = $str ~~ m/^<$re>/; say $test; but the match that is returned does not capture 'hello' 21:45
ugexe m: my $re = /(.*?)\n/; my $str = "hello\nthere"; my $test = $str ~~ m/^<$re>/; say $test; 21:46
camelia 「hello
ugexe i copy pasted your code 21:47
su.shi is there a way to preserve the capturing group? 21:48
ugexe m: my $re = /(.*?)\n/; my $str = "hello\nthere"; my $test = $str ~~ m/^$<foo>=<$re>/; say $test 21:50
camelia 「hello

foo => 「hello

0 => 「hello」
ugexe for some reason it'll show up if you name it 🤷
tbrowder__ tonyo: thank you.
su.shi say's very odd
maybe it's a bug?
ugexe it might just be a bug of the gist output of Match 21:53
nemokosch well, it's definitely not available indexed 21:58
wayland76 lucs: Yes, I was vaguely aware of the other reason ⇺ couldn't be an identifier as well, but at this point, I've just made it a prefix operator in my module, and I think that'll work (though at this point, I only have Pod, not code). 22:36
wayland76 glfdex: Interesting! 22:37
Hi! Just noticed the text in the Operators documentation: "for the precedence levels marked with ¹, there are no operator subroutines with that precedence level (usually because the operators at that precedence level are special-cased by the compiler). This means that you cannot access that precedence level when setting the precedence of custom operators.". Now to my question: Can I still add to a Sequencer (feed) operator, so that it works on my 22:44
objects?
nemokosch what do you mean "add to"? do you want to overload it? 22:46
wayland76 Yes! That's the word! How could I forget? 22:47
nemokosch I'm a bit concerned that it's just syntax 22:49
wayland76 nemokosch: What's the "it" to which you refer in your sentence? 22:52
nemokosch the feed operator
I didn't know there was also ==>> 22:54
it's "not yet implemented. Sorry" 😄 22:55
wonder what it would do
wayland76 Well, I've just conceptually created (ie. written Pod for) 5 different kinds of feed operators (where the regular ==> and <== only count as one of the types), so I can see lots of possibilities :) 22:58
nemokosch I have seen funky things from people around here but I think without monkeypatching the parser itself, you won't get to overload ==> and <== 22:59
they are special-cased in the parsing process
wayland76 A pity. Oh well. 23:00