🦋 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.
SmokeMachine I've just added some more data to my advent calendar post draft. if someone have some time to prof read it: gist.github.com/FCO/8ad2bd4cc3723e...e1690ed9df thanks 00:42
at Hey, is rakubrew.com down? 01:24
Looks like it's just the root page, the sh file for installing it's still being served 01:25
ugexe its .org i though 01:30
looks like .org is down though
at Err, yeah, I meant .org 01:31
frost ah, so funny, tikolu.net/emojimix/%F0%9F%98%82+%F0%9F%A4%91 02:09
samebchase m: (Date.new(2021,11,30) .. *).head(2)>>.&{ say "day is {$_.day}" }; 05:31
camelia day is 30
day is 1
samebchase I've been able to get this working using a topic variable, however my question is how do I create an inline lambda that takes in an arbitrary signature 05:32
meaning, if my sequence has a list of size-2 lists, I would like to do something like (SEQ-OF-SIZE-2-LISTS)>>.&{ ($a, $b) -> { say "$a, $b" }} 05:34
[(1,2), (3,4)]>>.&{ <LAMBDA-BODY> }, what's the syntax of defining lambdas that work with hyper operators with the "." method call syntax 05:36
samebchase m: (1 .. 2 X 3 .. 4)>>.&{ say $^a; }; 05:40
camelia 1
3
1
4
2
3
2
4
samebchase how do I deal with the data as pairs and not flattened
m: (1 .. 2 X 3 .. 4);
camelia WARNINGS for <tmp>:
Useless use of "X" in expression ".. 2 X 3 .." in sink context (line 1)
samebchase m: (1 .. 2 X 3 .. 4); 05:41
camelia WARNINGS for <tmp>:
Useless use of "X" in expression ".. 2 X 3 .." in sink context (line 1)
samebchase m: say (1 .. 2 X 3 .. 4);
camelia ((1 3) (1 4) (2 3) (2 4))
samebchase I want these "pairs" to be given the the lambda without flattening them, so 4 items, instead of 8 items. 05:42
samebchase "Whether hyperoperators descend into child lists depends on the nodality of the inner operator of a chain. For the hyper method call operator (».), the nodality of the target method is significant." from docs.raku.org/language/operators#i..._operators 05:44
how do I define an inline lambda here, which does not force the hyper operator to not descend into an inner list? 05:48
Something like: (1 .. 2 X 3 .. 4)>>.& -> ($a, $b) { say $a, $b }; where $a is 1 and $b is 3 on the first iteration 05:51
elcaro samebchase: use .map 05:56
(1 .. 2 X 3 .. 4).map(-> ($a, $b) { ... })
(1 .. 2 X 3 .. 4).map: -> ($a, $b) { ... } # Alternate syntax 05:57
samebchase elcaro: I understand `map` does that as it allows you to pass in a block. I was just wondering if there was a way to easily pass in arbitrary blocks with hyper operators. 05:59
I guess `map` is idiomatic here, and hyper operators are better off when the data is not nested. 06:00
elcaro you can't stop a hyper-operator from decending into children unless you explicitly specify the nodality, which you can really only do with a routine trait
yeah, I personally think `».&` is an anti-pattern outside of golfing 06:01
elcaro m: sub f($xs) { $xs.elems }; sub g($xs) is nodal { $xs.elems }; say (1 .. 2 X 3 .. 4)».&f; say (1 .. 2 X 3 .. 4)».&g 06:03
camelia ((1 1) (1 1) (1 1) (1 1))
(2 2 2 2)
samebchase my &f = sub ($a, $b) is nodal { say $a, $b }; followed by [(1,2),(3,4),]>>.&f; , but I still get the error "Too few positionals passed; expected 2 arguments but got 1" 06:04
elcaro i don't think there's any way to say a lambda `is nodal` and even if there was, it would be noisier that just using `map`
samebchase wait, let me see what you've just typed
elcaro you sub is not receiving 2 arguments... it's receiving a list of 2 elems 06:05
samebchase Ah, my function is expecting two args,
instead I need to destructure
elcaro unless you unpack in the sub
samebchase got it!
thanks so much elcaro
elcaro yeah like sub (@ [$a, $b]) { ... }
samebchase tl;dr: Use map, and don't mess with "is nodal" 06:06
samebchase Earlier, the use of ">>" as opposed to a map or a loop used to make me feel anxious, but now I think I'm overdoing hyperoperators in my quest to understand them. 06:07
elcaro yeah, plus `».` is not lazy, so it's not always ideal for that reason 06:08
I use them sparingly, usually to avoid map-inside-map, ie. I will typically prefer `*.map(*».foo)` over `*.map(*.map(*.foo))` 06:09
samebchase hmm ncie 06:21
nice*
Xliff How can I introspect .mvmheap files? 07:45
Ah! moarperf
Xliff Hmm... moarperf is bombing for me. Does anything else allow me to read .mvmheap files? 08:03
Xliff MoarPerf is choking on my .mvmheap files. These are generated from a (fairly) fresh rakudo. Any ideas as to a workaround? 08:32
frost m: my &f = sub (($a, $b)) is nodal { say $a, $b }; [(1,2),(3,4),]>>.&f;
camelia 12
34
frost samebchase ^^^ 08:33
elcaro frost: they were asking if it was possible with a point block, ie. [(1,2),(3,4),]».&(-> ($a, $b) { ... }) 09:39
I'm not aware of a way to make pointy blocks can be made nodal 09:40
can do it with anon subs, tho
say [(1,2),(3,4)]».&(sub ([$a, $b]) is nodal { $a + $b }) 09:41
evalable6 (3 7)
elcaro but with that noise, you may as well just use map 09:42
timo you can possibly use duckmap to do the hypering here 10:08
timo since hyper, as opposed to map, will traverse the struture and give the same structure back 10:08
timo Xliff: what does the choking look like? 10:08
Xliff: moarperf is supposed to be able to read moar heap snapshots version 2 as well as 3 10:09
(you get 3 if libzstd is present at moarvm Configure.pl time)
Xliff Ah... that might be why. 10:11
Let me recompile. 10:12
timo but it still shouldn't choke :D 10:14
Xliff Malformed UTF8 @ blah.,... 10:15
Didn't have -lzstd compiled in
timo i forgot why but reently we discussed perhaps shipping libzstd with moarvm and use that if it's not available in the system 10:17
samebchase elcaro: "say [(1,2),(3,4)]».&(sub ([$a, $b]) is nodal { $a + $b })" I just wanted to know if it was possible. Glad there is way to do that, even though it is not possible with pointy blocks. 10:34
Xliff timo: You might want to make sure libzstd support is compiled into MoarVM before you compress the heap files.
timo it's not trying to do that tho 10:46
qorg11 if i have a C function called with NativeCall that returned a file descriptor, how can I use that fd with IO::Handle? 11:26
Xliff qorg11: You're better off using NativeCall to grab the functions that use the file descriptor and use them. 11:56
frost I want to know, if a module uses NativeCall and I import it, do I have to declare `use NativeCall` when I use other native C callings? 12:23
lizmat all use statements in Raku are lexical 12:24
so yes
m: sub ok() { say "foo" }; { use Test; ok 1 }; ok
camelia ok 1 -
foo
frost ok, thanks lizmat 12:25
lizmat note the different versions of ok ^^
frost ok, i see
elcaro yeah, here reflects the difference between subs and point blocks 12:35
gfldex lizmat: Unless `package EXPORTHOW` is involved. Is that fixable in priciple? 13:00
timo slangs could do it i imagine 13:17
lizmat I'm not sure what needs to be fixed ? 13:30
timo it's more a question of breaking it than of fixing it 13:41
gfldex lolibloggedalittle: gfldex.wordpress.com/2021/11/30/mo...ssproduct/ 14:37
perryprog gfldex you might want to link to this week's challenge in the lede of the post so people like me can be lazy if we don't remember what it was 14:38
gfldex good call
perryprog <3 thanks 14:44
perryprog Also, awesome title 14:44
gfldex I would love to have the EVAL gone. 14:50
Nemokosch Why did you use it, then? 14:51
gfldex Because I needed that crossproduct and there is no method for that. 14:52
perryprog coughs up docs.raku.org/routine/cross
gfldex :O 14:53
Nemokosch What would you prefer instead?
gfldex List.cross ofc!
perryprog m: [1, 2, 3] X [3, 2, 1]
camelia WARNINGS for <tmp>:
Useless use of "X" in expression "[1, 2, 3] X [3, 2, 1]" in sink context (line 1)
perryprog well
m: [1, 2, 3] X* [3, 2, 1]
camelia Potential difficulties:
Useless use of X* in sink context
at <tmp>:1
------> 3[1, 2, 3] 7⏏5X* [3, 2, 1]
perryprog grumbles
I'm out of practice
gfldex m: dd cross(1,2,3 xx 3); 14:54
camelia ((1, 2, 3), (1, 2, 3), (1, 2, 3)).Seq
gfldex m: dd cross(|(1,2,3 xx 3)); 14:55
camelia ((1, 2, 3), (1, 2, 3), (1, 2, 3)).Seq
Nemokosch rip
m: dd cross((1,2,3) xx 3) 14:57
perryprog m: dd cross((1,2,3) xx 3) 14:58
camelia ((1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 2, 1), (1, 2, 2), (1, 2, 3), (1, 3, 1), (1, 3, 2), (1, 3, 3), (2, 1, 1), (2, 1, 2), (2, 1, 3), (2, 2, 1), (2, 2, 2), (2, 2, 3), (2, 3, 1), (2, 3, 2), (2, 3, 3), (3, 1, 1), (3, 1, 2), (3, 1, 3), (3, 2, 1), (3, 2, 2…
Nemokosch rip x2
perryprog I got you
gfldex I updated the blogpost with this fine simplification. 15:04
melezhik .tell tbrowder I am going to shut mybf.io down, after 2-3 month it seems that the site is not in use ... it was unsuccessful attempt ))) , could you please remove a link from raku.org? 15:47
tellable6 melezhik, I'll pass your message to tbrowder
melezhik ^^ SmokeMachine - looks like was the only user of the web site? 15:48
^^ tbrowder
SmokeMachine melezhik: really? sad news... :( I like that idea 15:49
tbrowder melezhik: will do, sorry, you sure you want to shut it down? if it isn't hard to maintain or cost money, i would leave it up. 15:51
rakuuns, like other ppl, have desires that change all the time, so who knows when it might take off! 15:52
melezhik SmokeMachine tbrowder sorry that I upset you , the site costs me some money - 30$ a months and I am not sure if there are any real users besides maybe SmokeMachine
tbrowder oh, i'm not upset, just sorry it didn't flourish. 15:54
melezhik my idea was to spin it off and then people would do comments, but realistically irc/reddit beat me here )))
spin off -> launch 15:55
tbrowder if the code is available maybe i can run it on one of my servers
melezhik for sure, code I can share the code ... but be aware - it is not optimal and very slow ( it needs a DB instead slow file system ) - and this is a one of the reasons it eats some resources 15:56
tbrowder and reddit is not a place i visit often. maybe make yr site just for Raku modules and projects.
melezhik but overall it's just a cro application with a state kept on the file system 15:57
so if you want to give it a try I can make a GH public and you can fork , will it work?
jast now I'm curious, what was the site about? can't access it so I assume it's already down
tbrowder pls make it public (but sanitize appropriately) 15:59
gotta get back to my advent article...back later... 16:00
melezhik tbrowder sure - do you mean to remove sensitive data ?
jast I can switch it on real quick, if you are curious ... 16:01
jast a one-line summary would do it, too :) 16:02
tbrowder yes, passwords, contact data not made public already, etc., root user info...
melezhik sure 16:03
jast I switched the site on
Altreus lizmat: there's a list in this doc that didn't seem to render correctly modules.raku.org/dist/IRC::Client:...zef:lizmat
dunno whose bug it is :)
jast ohh... yeah, that's a nice idea for sure
melezhik tbrowder let's do this - I am going to keep the site running for a couple of weeks or so and make the site source public, so you can fork it and try to host it on your own, we can arrange other stuff - like current site data - reviews/points/etc ( not a part of the repo ) and domain name later, 16:05
qorg11 Xliff: I'm trying to use read(), but is it possible to dinamycally allocate the buffer?
melezhik will it work?
tbrowder okay, let's give it a shot! 16:06
Altreus lizmat: oh, and the links don't work, but again, not sure whose bug... 16:08
melezhik tbrowder - github.com/melezhik/mybutterflies , and ... don't please bare with me , the site code is ugly sometimes :') 16:09
Altreus ah, for the links to work the URL has to end in a / and it doesn't redirect if there isn't one
melezhik bare -> bear 16:10
jast well as they say... 1. make it work 2. make it good 3. make it fast :) 16:11
and (2) has plenty of sub-steps 16:12
most of my projects stop getting updates somewhere in the middle of the first step 16:14
melezhik yeah, I guess the concept stage is pretty much finished , the implementation part is still in progress, from my pint of view the site lacks real users who would do comments/news/updates 16:15
jast getting users is the hardest part ;) 16:17
tbrowder yep, that's why the several young folks i know in the publicity world can make some big bucks/euros 19:42
[Coke] me: "AIGH WHY IS ADVENT POSTING HAPPENING ALREADY". me: remembers time zones exist.
tbrowder but they don't help s, 19:43
Nicholas [Coke]: you mean there are time zones other than UGT? :-)
[Coke] -1 for the explicit religious message at the end.
tbrowder *small fish much... 19:44
[Coke] my RSS feed shows me the article, but if I click to go to site, I get: raku-advent.blog/2021/11/30/santa-...ing-along/ which is a 404
tbrowder [Coke] i just discovered unposting works!
[Coke] ?? Why unpost? 19:45
I assumed it was on a schedule for Dec-01?
tbrowder cause i hit the post button inadvertently
[Coke] That'd do it
tbrowder when i wasn't ready
i hate wordpress, menus are horrible and misleading, html entry is terribly non-standard... 19:47
lizmat I wrote my blog post in markdown, committed it to github, copy-pasted the HTML representation, and was done :-) 19:48
tbrowder my article is there as draft with a scheduled post i think...something jj automated i think...
lizmat my biggest beef with WP was that it didn't allow me to schedule the post to be published at midnight 19:49
0 was not acceptable as an hour indicator :-( It would revert to whatever it had before 19:50
tbrowder i did it in pod and used Pod::To::HTML and inserted it into the code editor...had to remove the head part
[Coke] I often do 12:01 or 11:59 to avoid shenanigans. 19:52
(not in this context in particular)
floooh.github.io/tiny8bit-preview/ ... played around on the C64 emulator a bit. 19:55
Skarsnik Hello 21:12
Do I still need to use eval to add a token dynamicly to a grammar? 21:14
ugexe grammar Foo { token TOP { <foo> } }; role Bar { token foo { \w+ } }; my $g = Foo.new but Bar; 21:21
Skarsnik I am talking more about .^add_method x) 21:23
Ergo444 hi 21:53
HOw can I set a category for a package 21:54
in raku directory
Skarsnik I do $grmr.^add_method("instruction:sym<$token-name>", EVAL 'token {"' ~ $instruct.inst.lc ~ '"}'); but when I list the methods of the grammar all the token have no names. 21:59
but if I add the name of the token in the EVAL I got an error
[Coke] . 22:21
Skarsnik ah it's fun, ^methods on grammar give you the contents of the grammar x) 22:29
the issue EVAL does not let me have the name of the token :( 22:30
Ok, need to add my in front of token. *talk to himself* 22:33
tbrowder lizmat: you still here? 22:47
Skarsnik Hm, I have another issue, I need to inherit from my generated grammar in another one (static) but... that it can't find the generated type :( 22:48
tbrowder well, i used lizmat's method. it works sort of, best so far, though. but not all pod get's translated well to markdown, so still had to edit one list item that should have been a code block 23:07
has any Mac user tried "MarsEdit" for offline Wordpress blogs? 23:08
or, shudder, any win ppl used MS Word? for offline Wordpress blogs? 23:09