🦋 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.
00:00 reportable6 left 00:02 reportable6 joined 00:04 jpn joined 00:09 jpn left, derpydoo joined 01:04 xinming left 01:06 xinming joined 01:52 jpn joined 01:57 jpn left
SmokeMachine Based on lizmat 's post I started playing with the idea of translating map's, grep's and first's blocks to Red::AST at compile-time instead of trying to find out what they are doing at run-time. My first idea is something like this (gist.github.com/FCO/1d9faecbfaaa63...be3d08d8). It would add a named parameter :red-ast on every map/grep/first, methods other than Red's one would just ignore it (methods ignore unknown 02:15
named parameters) and Red's ones would use it instead of the block (if that's defined). Would that make any sense? Does anyone have a better suggestion? Thanks!
02:20 tea3po left 02:21 tea3po joined 02:23 teatwo joined 02:26 tea3po left 03:26 statisfiable6 left, evalable6 left, squashable6 left, unicodable6 left, committable6 left, shareable6 left, nativecallable6 left, releasable6 left, benchable6 left, linkable6 left, greppable6 left, notable6 left, reportable6 left, bloatable6 left, bisectable6 left, quotable6 left, sourceable6 left, coverable6 left, tellable6 left, sourceable6 joined, unicodable6 joined, greppable6 joined, linkable6 joined 03:27 shareable6 joined, releasable6 joined, notable6 joined, tellable6 joined, bisectable6 joined, coverable6 joined, quotable6 joined, benchable6 joined 03:28 reportable6 joined, nativecallable6 joined, squashable6 joined, bloatable6 joined, evalable6 joined, statisfiable6 joined 03:29 committable6 joined
tonyo would that require something like a preprocessor? 03:30
03:40 jpn joined 03:45 jpn left 04:31 jpn joined 04:44 jpn left 05:36 jpn joined 06:00 reportable6 left 06:02 reportable6 joined 06:26 xinming left 06:28 xinming joined 06:46 zara joined
SmokeMachine tonyo: I intend to add that as a custom compiler pass (if/when possible) 07:07
07:10 jpn left 07:18 rcy left 07:20 ab5tract left 07:38 sena_kun joined 08:07 nine left, m_athias left 08:08 nine joined, m_athias joined 08:11 dakkar joined 08:34 jpn joined 08:36 Sgeo left
lizmat SmokeMachine: looks ok to me, although I would probably take out the grep and put that into the for body 08:38
SmokeMachine lizmat: personal preference, or any reason? 08:39
lizmat: any other reason, I mean.
lizmat performance: you'd only have one level of iterators, instead of 2 08:40
and for me also readability
SmokeMachine lizmat: thanks! I’ll do that
lizmat: and is there a way to add a CHECK phaser from a module and/or add a custom compiler pass? 08:41
lizmat I hope to find out this weekend... :-) 08:42
SmokeMachine :)
lizmat adding a CHECK phaser from a module: maybe the EXPORT sub of a module should also have access to the $*CU of the importer 08:43
then it should be possible
SmokeMachine lizmat: Thanks! Please let me know if/when you find it out! (But I suppose you will make a blog post about that… :) ) 08:44
lizmat yes, I will :-)
SmokeMachine About $*CU… that’s odd to use it because it’s a very bad word in Brazilian Portuguese… 08:45
lizmat ok, maybe we need it to be more explicit: $*COMPUNIT 08:46
well, we have a RaboBank in the NL
SmokeMachine :)
About EXPORT having access to $*CU, would that be a different variable, right? 08:47
lizmat I guess... $*IMPORTER :-) 08:48
SmokeMachine I think that makes completely sense
08:49 ab5tract joined
SmokeMachine In that case we wouldn’t even need a CHECK, right?! Any change could be done inside EXPORT itself. 08:50
lizmat well,,, hhmmm.... the importer could have been precompiled already
SmokeMachine Willl the importer be already completely parsed when doing the import? 08:51
lizmat also a good question... probably not if it is still source 08:52
there's lots of angles we need to think about here :-)
and also I'm not quite awake yet :-) 08:53
SmokeMachine Maybe it should be able to export a phaser?
(Sorry for keep asking…)
lizmat yeah, stuff like that :-) 08:54
09:24 zara left 09:33 abraxxa joined
guifa_ votes for the more explicit $*COMPUNIT 09:57
CU is fairly opaque in meaning, and if someone wants a shorter expression, they can always do $CU := $*COMPUNIT or similar 10:00
SmokeMachine: is cu that strong of a word in BP? In EP it's fairly innocuous
SmokeMachine Yes, I’ve heard that in Portugal that means the same as “bunda” in BP, but in BP that’s not the case… 10:54
guifa_: ^^
11:00 linkable6 left, evalable6 left 11:02 linkable6 joined, evalable6 joined 12:00 reportable6 left 12:01 reportable6 joined 12:38 El_Che_ left 12:39 El_Che joined 13:06 derpydoo left
Nemokosch bunda lol 13:07
13:17 jgaz joined 13:29 derpydoo joined 14:20 tea3po joined 14:23 teatwo left 14:24 tea3po left, tea3po joined 15:04 xinming left 15:06 xinming joined 15:13 Sgeo joined 15:20 bigdata joined
librasteve anyone know unix? I can't get eval "$(/root/.rakubrew/bin/rakubrew init Bash)" in .bashrc to run on login ;-( 15:48
El_Che bash in capitals? 15:49
(no idea of how rakudobrew works)
librasteve i'll try lc
jdv knows unix
librasteve nope lowercase made no difference --- I just get rakubrew: command not found 15:51
doing the eval manually (with Bash) in each session works fine
jdv maybe man bash and search for startup and search path stuff? 15:54
El_Che ls -la /root/.rakubrew/bin/rakubrew
is the binary there? 15:55
librasteve yes --- all runs fine if I manually go eval "$(/root/.rakubrew/bin/rakubrew init Bash)" in each session
just when i echo that to my .bashrc it does'nt get picked up on ligin 15:56
jdv: thanks - I will try to do that ...
16:01 abraxxa left
It is normally run when you start a new login shell (not really desktop session, because you can run a new login shell from the desktop session). As I said, it is run by default, but not if you have created ~/.bash_profile or ~/.bash_login 16:13
oops - I made a .bash-profile!
16:15 squashable6 left 16:17 phogg left, squashable6 joined 16:35 dakkar left 16:59 jpn left 17:14 jpn joined 17:15 jmcgnh left 17:20 jpn left 17:24 jpn joined
gist.github.com/librasteve/f609bd6...baa1db1e3a 17:50
^^^ this works fine on 2022.02 but dies on 2023.04 17:51
I don't think I am doing anything wrong (but then I would say that)
[Coke] MoarVM oops: MVM_str_hash_fetch_nocheck called with a stale hashtable pointer 17:54
lizmat librasteve how does it do on 2023.05 ? 17:55
librasteve just building now
Nemokosch > say [+] dss; hm, why would this line work? 17:56
librasteve ^^^ did you check the links to the docs? 17:57
Nemokosch does it say anything about meta-operators? 17:58
18:00 reportable6 left
librasteve same error 18:01
18:02 reportable6 joined
docs.raku.org/type/List.html#routine_reduce says Returns a single "combined" value from a list of arbitrarily many values, by iteratively applying a routine which knows how to combine two values. 18:03
I then looked at my code and decided that the .iterator method is the one that helps reduce to do the iteration 18:04
18:07 jmcgnh joined
that's the great thing about raku ... everything is based on the same lower level building blocks 18:07
Nemokosch yeah well, if the behavior was better defined, like it was thoroughly tested that code X and more explicit code Y must do the same 18:09
anyway, bisectable time
18:09 NemokoschKiwi joined
librasteve raku behaviours are fully defined by the ROAST test suite 18:10
lizmat librasteve: adding a method Numeric { self.elems } seems to fix the issue ?
NemokoschKiwi bisectable6: old=2022.02 gist.github.com/librasteve/f609bd6...baa1db1e3a 18:11
bisectable6 NemokoschKiwi, Bisecting by exit code (old=2022.02 new=4b69dd5). Old exit code: 0 18:12
Nemokosch this, without the "fully" part 18:13
bisectable6 NemokoschKiwi, bisect log: gist.github.com/b0a4bb1ebf3d5007f9...84366abe27
NemokoschKiwi, (2023-02-16) github.com/rakudo/rakudo/commit/6b...fb68efa146
librasteve OK - will do that, thanks for the advice
suppers ready - must dash! 18:14
NemokoschKiwi I even checked this commit, should have read the message as well...
18:17 NemokoschKiwi left 18:27 codesections left
librasteve oh just have a quick chance to read the commit message - aha! can someone explain the relationship between reduce() and .iterator - eg. (i) none, (ii) reduce sometimes uses iterator (if so when), (iii) reduce always uses iterator so that I can understand and maybe propose a tweak for the docs? 18:30
Nemokosch this is not reduce() and I suspect they don't even call the same code 18:35
as sad as it sounds
hm, they do, in a rather wild way 18:38
18:38 jpn left
github.com/rakudo/rakudo/blob/a1ac...de.pm6#L20 18:38
18:47 jpn joined
I don't know, it's not obvious to me why it's not right 18:48
my guess would be, it revolves somewhere around this "single argument slurpy" +values
yep - if you write a function like perl sub demo(+values) { dd values; } demo(dss); 18:58
you will see that it gives (DataSlice.new(data => Array[Any].new(1, 3, 5, 42, 6, 8)),)
that is: a one-element list with a DataSlice in it
my gut feeling was right: the method you need to overload the most is actually the list method 19:01
if you add method list { @!data.list }
suddenly it will work
19:08 abraxxa-home joined 19:28 derpydoo left 19:36 jpn left 19:52 zxrom joined
Tirifto_ elcaro, wow! I searched for a Curses library on modules.raku.org, but found nothing, so I assumed one just didn’t exist for Raku. 19:58
20:00 arch left
Tirifto_ I’ll give it a try and see if it covers my needs (which are fairly modest, so probably yes). Thanks for the mention! :D 20:00
(Also thanks nine and [Coke] for help. I ended up writing a wrapping class, as that was ultimately sufficient for my needs.) 20:03
By the way, what’s the ideal way of keeping track of the previous element in a for loop? At the moment I just do ‘state $previous’ at the start of the loop, and ‘$previous = $_’ at the end, but I wonder if there are other straightforward ways? Like passing the block two arguments from the list, but only consuming one of them? (So ‘a b c d’ would get you ‘a b’, ‘b c’, ‘c d’.) 20:07
gfldex Tirifto_: you may want to use `.rotor(2 => -1)` 20:09
Tirifto_ gfldex, thank you, that seems to be what I had in mind! 20:16
Seems like to pass two elements as arguments, one can do ‘.rotor(2 => -1).flat’.
20:20 abraxxa-home left 20:21 jpn joined, abraxxa-home joined
librasteve ++ that' sounds good - I am also toying with delegation so will pull all that together tomorrow 20:23
Nemokosch not gonna lie, I don't know how this + works, it's grammar level and affects QAST generation directly 20:26
20:26 jpn left
but this rule of thumb that "sigils work based on .list" works here as well 20:26
That's why Blob and Buf mostly work as an Iterable, even though they aren't - they provide an appropriate .list method 20:27
20:44 abraxxa-home left 20:45 jpn joined 20:46 sena_kun left 20:58 sena_kun joined 21:06 jpn left 21:08 jpn joined 21:12 kst joined 21:13 phogg joined 21:20 phogg left, phogg joined 21:25 sena_kun left 21:29 jpn left 22:29 evalable6 left, linkable6 left 22:30 evalable6 joined 22:32 linkable6 joined 22:42 jpn joined 23:37 arch joined 23:51 jpn left