🦋 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.
SmokeMachine antononcube: if you’d like to use some kind of template, would you like to try Cromponent? It uses Cro templates… 00:30
01:06 stanrifkin joined 01:30 hulk joined 01:31 kylese left 01:41 ACfromTX left 01:52 derpydoo joined 01:54 ACfromTX joined 02:15 hulk left, kylese joined 02:22 gabiruh_ joined 02:23 gabiruh left 02:50 wayland76 left, wayland joined 03:02 derpydoo left 03:30 undoencalma joined 03:42 stanrifkin_ joined 03:45 stanrifkin left 03:58 undoencalma left 04:22 PipStuart joined 04:30 kylese left 04:34 kylese joined 04:36 Aedil joined 05:05 guifa left 05:30 kylese left 05:33 kylese joined 05:37 Aedil left 05:41 wayland left 05:42 Aedil joined 06:54 wayland joined, wayland left, wayland76 joined 07:04 timo left 07:07 timo joined
librasteve MAsterDuke: thanks - now merged 07:09
tellable6 librasteve, I'll pass your message to MasterDuke
07:44 apac joined 08:05 apac left 08:27 derpydoo joined 08:54 yewscion_ left, yewscion_ joined, Xliff_ joined 08:55 samebchase4 joined, gfldex left, samebchase left, samebchase4 is now known as samebchase 08:56 gfldex joined 08:57 Xliff__ left 09:03 wayland76 left, wayland joined 09:22 sena_kun joined 09:41 Guest96 joined
Guest96 Hello, can somebody explain to me why `.say for 1..3;` will print the every number of the range, but if I put the range in variable like `my $myrange = 1 .. 3;` and then try to `.say for $myrange;` it prints 1..3 ? 09:44
09:45 Guest96 left 09:57 wayland76 joined, wayland left
lizmat because the range 1..3 is itemized in the container 10:00
and items don't iterate
grondilu is there such a thing as "alternation without repetition"? Like I'd like to match a sequence of tokens <a>, <b>, <c> ... but with at most one occurence of each. An arrangement, basically. 10:10
grondilu checks wikipedia for the word "arrangement" 10:12
grondilu learns it's just the French for "partial permutation" : en.wikipedia.org/wiki/Partial_permutation
lizmat [ <a> | <b> | <c> ]?
or:
[ <.a> | <.b> | <.c> ]? 10:13
if you're not interested in which token matched
grondilu no, I'd like to match abc or bca, but not aab nor abb 10:16
kind of tricky to do with regex, right? 10:17
lizmat yeah, nothing comes to mind at the moment 10:18
wambash m: my $ab = "ab"; say "1ab2".match: /<?after $ab> \d/; say "1ab2".match: /\d <?before $ab>/ 10:19
evalable6 Nil
「1」
Raku eval Nil 「1」
grondilu I guess with code assertion !$++ in each subregex 10:21
m: say "aab" ~~ /[ a <?{ !$++ }> | b | c]+/ 10:35
camelia 「aab」
grondilu m: say "aab" ~~ /[ a <?{ note $++; !$++ }> | b | c]+/ 10:37
camelia 0
「aab」
0
grondilu m: say "aab" ~~ /[ a <?{ !(state $)++ }> | b | c]+/
camelia 「aab」
grondilu really?
m: say "aab" ~~ /[ a <?{ note (state $n)++; !$++ }> | b | c]+/
camelia 0
「aab」
0
grondilu m: say "aab" ~~ /[ a { note (state $n)++ } | b | c]+/
camelia 0
「aab」
0
grondilu * 10:38
m: my %cache; say "aab" ~~ /[ a <?{ !%cache<a>++ }> | b | c]+/ 10:39
camelia 「a」
grondilu m: my %cache; say "acb" ~~ /[ a <?{ !%cache<a>++ }> | b | c]+/
camelia 「acb」
lizmat !@tokens.first( $string.comb($_, 2) == 2 )
!@tokens.first({ $string.comb($_, 2) == 2 }) 10:40
grondilu that's not a regex though. Initially I wanted something to put in a grammar. 10:41
lizmat you could put this code in a token? :-) 10:42
grondilu meh 10:43
lizmat I mean, the idea of having a regex syntax to do what you want, would be nice
but under the hood, it would probably turn out to be something logically the same as the code I just posted 10:44
10:59 Sgeo left
grondilu unrelated : I need to sort chess move scores. Problem is, forced mates should trump all other moves, regardless of their evaluation. 11:30
so I guess I could use infinite ordinals or something.
grondilu considers writing an omega function 11:31
stanrifkin_ Engine evaluation scores?
This is in pawn units. And in case of forced mate with another notation. #2 for mate in two for example. 11:32
grondilu there are three kinds : finite evaluation, lower and upper bounds, and forced mate.
it'd be nice if I had a unique comparison for them all.
thus my idea of using omega ordinals for forced mates. 11:33
I could write an `Ordinals` module, I suppose 11:34
lower and upper bounds can map to -Inf and +Inf, though. 11:35
mate in 3 should be -3ω 11:42
11:50 melezhik joined
melezhik .tell grondilu: you may try Sparrow task check which is a sort of regex based engine - gist.github.com/melezhik/58cf7687a...d220cd9be2 , I am not however sure if this is exactly what's you looking for 11:52
tellable6 melezhik, I'll pass your message to grondilu
12:05 derpydoo left 12:11 melezhik left
grondilu (or rather ω-3) 12:26
tellable6 2025-04-05T11:52:46Z #raku <melezhik> grondilu: you may try Sparrow task check which is a sort of regex based engine - gist.github.com/melezhik/58cf7687a...d220cd9be2 , I am not however sure if this is exactly what's you looking for
12:33 lichtkind joined 12:43 apac joined 13:22 Altai-man joined 13:24 sena_kun left 13:25 guifa joined
librasteve @antononcube ... initial knee jerk reaction to "Air as Shiny Apps Alternative" is (i) this is definitely the vision for Air ... a library of reusable web components like the slider widget in your example, (ii) I think we could do the example you shared with two new components - a slider and an SVG chart - both using HTMX for interactivitiy (iii) the slider would be straightforward with event stream done like the 13:31
Search box here :hx-trigger<keyup changed delay:500ms, search>, github.com/librasteve/Air-Play/blo...kumod#L29, we would like need to wire up some raku Supplies and Taps to handle the event stream on the server side (iv) charts would be a bit trickier depending on the fatures needed ... I would lean toward an SVG / HTMX combination - do you have a favourite
SNG chart library to start with(?) ... I would be happy to add this to the backlog but would like to get an idea of the MVP needed to make this viable surely the slider is one of several components that would be needed?
^^ this now in an issue here ... github.com/librasteve/Air/issues/11 for futher elaboration and nailing the MVP deliverables 13:32
Guest96: I would just like to extend lizmat's answer, if you put your range in a raku @ variable, then it works as you wish: 13:36
m: my @myrange = 1..3; .say for @myrange
evalable6 1
2
3
Raku eval 1 2 3
lizmat note that in that case, the array is filled with all of the elements in the range
which could be a lot if you go 1 .. 10000000 13:37
afk&
librasteve well, yes - after a while you will get to know that ranges are lazy and that the array assignment expands them ... but as a newcomer to raku, likely from non lazy languages, then using the @ variable for many things and the $ variable for one thing imo follows the principle of least surprise 13:40
grondilu I'm trying to turn an array of pairs str => Real into the same array but with cummulated values sums. 14:42
m: my $sum = 0; my @a = 'a'..* Z=> rand xx 5; @a .= map: { .key => $sum += .value } 14:43
camelia ( no output )
grondilu m: my $sum = 0; my @a = 'a'..* Z=> rand xx 5; @a .= map: { .key => $sum += .value }; say @a;
camelia [a => 3.481080901324969 b => 3.481080901324969 c => 3.481080901324969 d => 3.481080901324969 e => 3.481080901324969]
grondilu m: my $sum = 0; my @a = 'a'..* Z=> rand xx 3; say @a .= map: { .key => $sum += .value };
camelia [a => 1.7627324343330133 b => 1.7627324343330133 c => 1.7627324343330133]
grondilu m: my $sum = 0; my @a = 'a'..* Z=> rand xx 3; say @a.map: { .key => $sum += .value };
camelia (a => 0.6534314562401136 b => 1.4464892627182224 c => 2.190641317438949)
grondilu what am I missing here? 14:44
notice that it works fine if I'm not dealing with pairs but just numbers
m: my $sum = 0; my @a = rand xx 3; say @a.=map: { $sum += $_ }; 14:45
camelia [0.43712039670076763 1.0023124961196177 1.4828298577032393]
grondilu m: my $sum = 0; my @a = 'a'..* Z=> rand xx 3; say @a = @a.keys => [\+] @a.values; 14:46
camelia Cannot resolve caller Numeric(Pair:D: ); none of these signatures matches:
(Mu:U \v:: *%_)
in block <unit> at <tmp> line 1
grondilu m: my $sum = 0; my @a = 'a'..* Z=> rand xx 3; say @a = @a>>.key => [\+] @a>>.value;
camelia [[a b c] => (0.9336132678748512 1.7509098305802246 2.1675409440551583)]
grondilu I guess I can do it like that
but I don't get what was wrong in the command above. 14:47
antononcube @librasteve "JavaScripdt::Google::Charts" provides (embeddable) HTML graphics and they can have sliders. I was thinking about finding a good non-Raku library that does SVG graphics and link to it in Raku in some way. 14:51
Again, if "JavaScripdt::Google::Charts" can be used in "Air" and "HTMX" then that is much closer to ideal. (It will be at least "very good.") 14:53
14:56 abraxxa-home joined, abraxxa-home left 14:58 abraxxa-home joined
nahita3882 grondilu: in the nonworking command all the values of your pairs "look at" the same container that $sum is associated with 15:00
therefore all have the last value $sum has
so much so that if you do, e.g., $sum = 72; after the fact, and then print @a, you'll see all 72s 15:01
so if you strip off the container when making the pairs, you'll have the desired effect
e.g., ($sum += .value).self or other N ways of decontainerization should work
grondilu % 15:03
^sorry, typed by mistake 15:04
15:05 stanrifkin_ left
grondilu nahita3882: I really thought scalar variables were immune to that kind of tipfall 15:05
m: my $sum = 0; my @a = 'a'..* Z=> rand xx 5; say @a .= map: { .key => ($sum += .value)<> }
camelia [a => 0.9763851204704463 b => 1.3078215989256017 c => 1.5478172090406122 d => 2.3583733374901206 e => 2.5680499796797016]
grondilu seems like you're right, though. 15:06
baffles me tbh
m: my $sum = 0; my @a = 'a'..* Z=> rand xx 5; say @a .= map: { .key => +($sum += .value) }
camelia [a => 0.945161305362382 b => 1.2269895564958269 c => 2.0093846507942326 d => 2.8348487689128192 e => 2.835551264392931]
grondilu for good measure:
m: my $sum = 0; my @a = 'a'..* Z=> rand xx 5; say @a .= map: { .key => $sum += .value } 15:07
camelia [a => 2.6147597830886067 b => 2.6147597830886067 c => 2.6147597830886067 d => 2.6147597830886067 e => 2.6147597830886067]
grondilu damn
15:10 stanrifkin joined
nahita3882 scalar variables are rather exactly the source of this, no? 15:20
16:58 apac left, Aedil left
librasteve grondilu: its not too baffling if you look at it like this ... .key => $sum makes a Pair where the value is the scalar container $sum. Then you do some fiddling with the value in $sum via a repeated $sum += .value. But every time you are making a Pair with the same container $sum. So every Pair you have has the same container and this contains the last value you put in it. 17:04
17:10 Aedil joined
antononcube @librasteveWhen I try to install "Air" installing of "Data::Dump::Tree" fails. Had to insall it with zef install Data::Dump::Tree --/test : maybe that should be in the README of "Air". 17:16
17:35 abraxxa-home left, melezhik joined
melezhik . 17:35
here is another alternative solution for parsing netrc file, please vote IF you like it - stackoverflow.com/a/79557308/5147708 17:36
librasteve @antononcube tx - i will just rm it from the deps 17:44
ok latest release 0.0.13 is solved 17:47
17:53 melezhik left 17:54 apac joined 18:15 apac left 18:51 Sgeo joined 19:01 maylay left 19:02 maylay joined 19:36 apac joined 20:15 Aedil left 20:23 codesections joined 20:25 codesections left 21:34 apac left 21:38 ACfromTX left 21:52 ACfromTX joined
made an issue for Data::Dump::Tree github.com/nkh/P6-Data-Dump-Tree/issues/65 22:25
hopefully nhk will respond
22:25 guifa left 22:39 guifa joined 22:43 Altai-man left
[Coke] added some details - looks like the test is depending on something it shouldn't. 22:48
22:49 wayland76 left 22:50 wayland76 joined 23:44 lichtkind left