🦋 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.
grondilu LAST allows to execute code at the last iteration of the loop, but is there a way to execute code at each iteration BUT the last one? 09:17
tellable6 2023-03-07T22:47:24Z #raku <guifa> grondilu: in fact, I'm working on a code tidier that's based on RakuAST nodes. It's still very basic now, but while core should only provide rudimentary node to string capabilities, moduels are a great place to do even more
Nemokosch well, how do you know (more accurately, when do you know) that an iteration is the last one? 09:18
grondilu "I don't know" (with screen-rant tone) 09:20
(or rather pitch meeting)
Anyway, looking at the doc, NEXT might do the job 09:21
Nemokosch idk what they are
grondilu tries it
Nemokosch: nevermind I was trying to be quirky
tellable6 grondilu, I'll pass your message to Nemokosch 09:21
grondilu hum, nope. NEXT will also run at the last iteration. 09:22
dakkar grondilu: do you need your code to run at the beginning of each iteration, or at the end? 09:23
Nemokosch that's what I kinda tried to approach - you wouldn't know what the last iteration was in general, without trying to start over
grondilu I want the code to run at each iteration but the last one. 09:24
dakkar "at" is not precise enough… 09:25
grondilu I mean LAST knows what the last iteration is, so why can't I define "not LAST" or something?
dakkar: oh sorry I see what you mean now.
Nemokosch but like, do you understand the theoretical limits?
dakkar m: for 1..1 { say "loop"; LAST say "last" }
camelia loop
last
09:26
dakkar it can't do "last" before running the block for the last time 09:26
Nemokosch that you need to at least attempt to start the next iteration to know that the previous one was the last one?
dakkar (of course it could in this very trivial example, but in general it can't)
I guess `for … { …; LAST { something } }` is pretty much `do { for … { … }; LEAVE { something } }` 09:28
or just `{ for … { … }; something }`
(with different names visible, of course)
grondilu I think using a phaser was a bad idea. I'll do something like `for @array { do-this; do-that unless ++$ == @array; }` 09:32
not very elegant but oh well. 09:33
Nemokosch it sounds kinda interesting that you need to do something like that at all
Anton Antonov weekly: rakuforprediction.wordpress.com/20...nd-onions/
Nemokosch won't work through discord :c 09:34
grondilu Nemokosch: if you're curious, I'm trying to display an image on the terminal using kitty's protocol. I have to split the image data in chunks, and print it with a specific code for each chunks but the last one. 09:35
tellable6 grondilu, I'll pass your message to Nemokosch
lizmat grondilu: LAST does *not* know it's the last iteration. 09:36
the LAST phaser gets run *after* the iterator was exhausted, but still inside the scope of the loop body
Nemokosch hm, perhaps I'd use an oldschool while, after constructing the first line individually 09:37
dakkar grondilu: a more "obviously can't work" example would be something like `while ($buffer.bytes < $limit) { read-more-into-buffer($buffer) }`
Nemokosch assuming that the specific code comes after the data
grondilu m: gist.github.com/grondilu/c1a1e1e3d...2d15d206c9 09:52
camelia _Ga=T,f=100,m=1;iVBORw0KGgoAAAANSUhEUgAAAQUAAADzCAYAAACPKgMhAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAPYQAAD2EBqD+naQAAAAd0SU1FB9kHEQMHOihr+oEAAAAadEVYdENvbW1lbnQAQ3JlYXRlZCBieSBTdS1TaGVlVsN9NAAAAAZiS0dEAP8A/wD/oL2nkwAA4FtJREFUeNrsXQd4FNXa3pJegQBJIPTeSejSpAmoCC…
grondilu ah, too bad.
grondilu was kind of hoping this would pop the camelia logo even through IRC 09:53
grondilu swears it's not to spam pictures lol
Geth ecosystem/main: 61a151586a | (Elizabeth Mattijsen)++ | META.list
Remove Digest::SHA1::Native

It lives on CPAN as well
12:19
lizmat sanity check: does this link work for anybody? s.thenautilus.net/notes/9c23tku1am 12:38
I would hate to put it in the weekly if it doesn't work on its own 12:39
Nemokosch seems to work 12:49
looks like a kind of sidebar twitter
lizmat ok, so it's a Mojave / Safari issue 12:53
that *I* seem to have :-) 12:59
grondilu Anybody has an idea of how the palette in rosettacode.org/wiki/Mandelbrot_set#Raku was generated? Is there a formula somewhere? 13:57
Anton Antonov @grondilu Interesting. I probably have to demonstrate how to do that with "JavaScripdt::D3" and/or "Text::Plot". 14:04
rf Morning folks 14:06
grondilu Anton Antonov: you're referring to displaying images in a terminal? 14:11
Anton Antonov @grondilu Well, I was talking about making Mandelbrot plots with Raku, but, yes, "Text::Plot" can be used in a terminal. 14:24
grondilu .seen raydiak 15:47
tellable6 grondilu, I saw raydiak 2021-10-16T17:14:00Z in #raku: <raydiak> fair enough :)
tonyo think i finally have the globber working like git ignore 16:48
anyone that's having trouble with it available to test?
Voldenet grondilu: the palette there resembles simple hue color circle with various darkness levels 17:13
Voldenet more obvious when you align it properly i.imgur.com/bV2qzFE.png 17:15
grondilu forked Image::PNG::Portable and added kitty protocol support: github.com/grondilu/Image-PNG-Portable 17:18
grondilu ^that seems to work. The example is mandelbrot and the gist method includes the kitty escape sequences. 17:19
Xliff \o 18:08
tonyo vrurg_: can you point me to your repo with the .gitignore and i can true up git ls-files to my globber? 18:19
tonyo nvm, i think i got this trued up to what .gitignore does. doesn't handle cascading yet though 20:23
Xliff \o 20:39
Can submethod BUILD be multi?
m: class A { multi submethod BUILD ( :$a is required ) { say "A" }; multi submethod BUILD ( :$b is required ) { say "B" }; }; A.new( :a ); A.new( :b ) 20:42
camelia A
B
Xliff Oooohhh... the chaos!
tonyo bisectable6: class A { has $!a; submethod BUILD ($!a) { } }; A.new(5); 21:41
bisectable6 tonyo, Will bisect the whole range automagically because no endpoints were provided, hang tight
tonyo, ¦6c (67 commits): «Default constructor for 'A' only takes named arguments␤ in block <unit> at /tmp/j04vvASDaj line 1␤␤ «exit code = 1»»
tonyo, Nothing to bisect!