00:03
yewscion left
00:07
yewscion joined
00:12
yewscion left
00:14
yewscion joined
00:19
zenmov left,
yewscion left
00:56
yewscion joined
01:52
Manifest0 left
02:25
zenmov joined
02:26
kylese left
02:27
hulk joined
02:33
Aedil joined
03:03
MasterDuke joined
03:15
hulk left,
kylese joined
03:40
yewscion left,
kjp left
03:41
kjp joined,
zetaaaa left
03:48
eseyman left
04:07
yewscion joined
04:18
yewscion left
04:32
guifa joined
05:10
guifa left
05:23
yewscion joined
05:28
yewscion left
05:37
yewscion joined
05:42
yewscion left
06:09
leif joined
06:24
leif left
06:31
Sgeo left
06:58
eseyman joined
07:22
yewscion joined
07:27
yewscion left
07:39
yewscion joined
07:44
yewscion left
08:05
abraxxa-home left
08:28
yewscion joined
08:32
yewscion left
08:48
sena_kun joined
09:02
dakkar joined
09:03
dakkar left
09:05
dakkar joined
|
|||
patrickb | How can I pass through named args in a signature? sub pd(*@pos, *%named) { pretty-dump(|@pos, |%named).put; } <- This seems to pass the nameds as a positional. | 09:35 | |
lizmat | m: sub a(|c) { dd c }; my %h = :42a, :666b; a |%h | 09:55 | |
camelia | \(:a(42), :b(666)) | 09:56 | |
lizmat | m: sub a(|c) { dd c }; my %h = :42a, :666b; my @a = 1,2,3; a |@a, |%h | ||
camelia | \(1, 2, 3, :a(42), :b(666)) | ||
lizmat | I don't see that? | ||
09:57
sena_kun left
10:00
sena_kun joined
10:06
sena_kun left
|
|||
patrickb | So |c does the trick. | 10:21 | |
Geth | advent/main: a96487c518 | (Elizabeth Mattijsen)++ (committed using GitHub Web editor) | raku-advent-2024/authors.md Add Richard's 2nd post |
10:41 | |
10:49
gfldex left
11:25
librasteve_ left
11:52
merp left
12:05
merp joined
|
|||
lizmat | and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2024/12/02/2024-49-advention/ | 12:48 | |
xinming | m: my @x = (1..5, (8..10).list); @x = |@x; @x.raku.say; for @x -> $t { $t.say } | 13:09 | |
camelia | [1..5, (8, 9, 10)] 1..5 (8 9 10) |
||
xinming | m: my @x = (1..5, 8..10); @x = |@x; @x.raku.say; for @x -> $t { $t.say } | ||
camelia | [1..5, 8..10] 1..5 8..10 |
||
xinming | i know I can use 1..5, or use (8..10).list, But still curious, is there other right way to expand a range? | 13:10 | |
When I found (my @x = (1..5, 8..10)) returns an array with 2 range objects, which suprise me. :-) | 13:11 | ||
lizmat | perhaps raku.land/zef:lizmat/OneSeq is what you want? | ||
% raku -e 'use OneSeq; say (1..3) >>> (8..10)' | 13:12 | ||
(1 2 3 8 9 10) | |||
xinming | lizmat: Not Seq, I already achieve that with (1..5).list | ||
13:15
gfldex joined
13:38
yewscion joined
13:50
yewscion left
|
|||
Geth | advent/main: 7b9bbadffd | (Elizabeth Mattijsen)++ (committed using GitHub Web editor) | raku-advent-2024/authors.md Update scheduled / published |
13:58 | |
timo | .tell raiph the performance of the fibonacci sequence code in raku is almost guaranteed to be due to the caching in the sequence operator, since the number of calls to generate a fibonacci sequence with the naive recursive approach is quadratic, it's not fair to compare one vs the other | 14:01 | |
tellable6 | timo, I'll pass your message to raiph | ||
antononcube | Any experts on SVG here? | 14:09 | |
lizmat | I know what it stands for :-) | ||
antononcube | š | 14:10 | |
I am interested in figuring out how much time to invest in making Raku produce SVG-based graphics for exploratory data analysis. | 14:11 | ||
lizmat | I'm pretty sure librasteve would like it :-) | 14:12 | |
antononcube | Maybe it is a very good idea. But I have spent too much time "investing" in JavaScript graphcs. | ||
lizmat | as would I :-) | ||
antononcube | @lizmat Ok. Why would you? š | 14:13 | |
lizmat | more modules == better :-) | ||
antononcube | Ah, yeah, sure. | ||
lizmat | seriously, I think I would use it at some point | 14:14 | |
especially now since all browsers support them natively (right?) | |||
antononcube | Yes. | 14:17 | |
That is the main reason I asked -- it seems it is much easier and portable to render SVG graphics in Jupyter notebooks. | 14:18 | ||
For example, GitHub does not render JavaScript plots in the Jupyter notebooks, but it does render the SVG ones. | |||
lizmat | right, and SVG files would be easier to generate, no? | 14:19 | |
antononcube | I am not sure. That is an interesting general question -- that is why I asked for expert guidance/opinion. š | 14:20 | |
I just made this Jupyter notebook update to show SVG: github.com/antononcube/RakuForPred...et-1.ipynb | |||
Currently, I rarely generate SVG directly, but using the Graphviz framework (for graphs) to generate SVG images is really nice. | 14:22 | ||
Also, I can make SVG animations with Raku in Jupyter! | |||
Making animations with JavaScript within the Raku kernel is not easy. (To me, at least.) | 14:23 | ||
14:27
pierrot left,
pierrot joined
14:30
zetaaaa joined
|
|||
xinming | Is there a way to get idx with .map method? | 14:35 | |
.grep has :k adverb to return idx. is it possible to additional add $idx of element being processed | 14:36 | ||
holmdunc | @antononcube I'm certainly no expert, but was looking at www.pygal.org the other day to produce SVG markup for basic charts server-side (rather than using the Chart.js library in the browser client-side) | ||
xinming | m: my @x = (<a b>, <c d>); for @x[]:kv -> $idx, @v { [$idx, @v].raku.say }; @x.map({ .raku.say }, :kv) | ||
camelia | [0, ("a", "b")] [1, ("c", "d")] $("a", "b") $("c", "d") |
||
nahita3882 | there are options. anonymous state variable is one, or .kv'ing your iterable and then using a function with 2 arity to access index and value is another option | 14:37 | |
second one: | |||
m: my @x = <y e s>; @x.kv.map({ say "idx: $^idx, val: $^val" }) | |||
evalable6 | idx: 0, val: y idx: 1, val: e idx: 2, val: s |
||
Raku eval | idx: 0, val: y idx: 1, val: e idx: 2, val: s | ||
xinming | m: my @x = (<a b>, <c d>); for @x[]:kv -> $idx, @v { [$idx, @v].raku.say }; @x[]:p.map({ .raku.say }, :kv) | 14:38 | |
camelia | [0, ("a", "b")] [1, ("c", "d")] 0 => $("a", "b") 1 => $("c", "d") |
||
xinming | nahita3882: Thanks. the .kv is what I wanted to ask. | ||
14:41
perlbot left,
simcop2387 left
|
|||
antononcube | @holmdunc I experimented with "Chart.js", since I wanted a simpler more pre-canned way to produce graphics than D3.js. Decided to bet / invest on Google Charts. | 14:41 | |
xinming | I just backlog, And I asked once not long ago. Seems I'm going old and being forgetful. :-( | ||
holmdunc | Yeah I tried Google's some years ago, seemed good too. The main thing I wanna avoid with charts is rendering to an actual bitmap image server-side, because then you get stuff like the font rendering looking wrong compared to the rest of the text on screen | 14:49 | |
antononcube | Also, it seems that LLMs know SVG pretty well. So, "plunging into" SVG graphics via Raku for data analysis might not be that frustrating... | ||
14:50
simcop2387 joined
14:51
MasterDuke left,
perlbot joined
|
|||
For me, the decoration graphics elements are very important. It is easy to make a bar chart (in SVG or whatever.) The hard thing is to have all bar chart options, like, grid lines, ticks, tick labels, axes labels, plot label, callouts, tooltips, etc. That is why I worked with D3.js a lot. (Again, for/within Raku.) | 14:53 | ||
14:56
euandreh1 joined
|
|||
holmdunc | Yeah it's sometimes hard to even remember the full vocabulary that a given library uses for all these things | 14:57 | |
antononcube | Right! That is the other reason I went for Google Chart -- old (i.e. good WWW representation), comprehensive documentation, and LLMs seem(ed) to know it well. | 14:58 | |
15:07
yewscion joined
15:43
euandreh1 is now known as euandreh
15:59
yewscion left
16:17
yewscion joined
16:21
yewscion left
16:30
yewscion joined
16:31
guifa joined
|
|||
Geth | advent/donaldh-advent: d80d48e36e | (Donald Hunter)++ (committed using GitHub Web editor) | raku-advent-2024/authors.md Add donaldh for day 24 to authors.md |
16:45 | |
advent: donaldh++ created pull request #123: Add donaldh for day 24 to authors.md |
|||
advent/main: f08104cfa4 | (Donald Hunter)++ (committed using GitHub Web editor) | raku-advent-2024/authors.md Add donaldh for day 24 to authors.md (#123) |
16:49 | ||
[Coke] | is there a secret to writing a reduce with a comparator instead of a normal operator? | 17:05 | |
I want something like [<] but with a &strictly-monotonic or something. | |||
I guess the secret is: not actually a straight reduction like it would be with the &plus example. | 17:11 | ||
guifa | with a traditiona comparator? .min(&strictly-monotonic) | 17:12 | |
or .max(&strictly-monotonic) | |||
err | |||
no | |||
sorry that's not te same thing ignore my thinking outloud | |||
antononcube | But why specifying reduce in that way would work? Also, maybe &strictly-monotonic has to be made listable? | 17:14 | |
[Coke] | m: say [<] <1 2 3 4>; say [+] <1 2 3 4> # these seem to work differently | 17:15 | |
camelia | True 10 |
||
[Coke] | and I can implement the latter with a custom routine, but not the former. | 17:16 | |
guifa | I've decided I need to port Mozilla's Readability | ||
antononcube | To be clear, I think you are trying to do [and] |@a.rotor(2=>-1).map({ &strictly-monotic(|$_) }) | 17:17 | |
[Coke] | yup, just was hoping for the better syntax. | 17:22 | |
17:34
dakkar left
|
|||
ab5tract | "and I can implement the latter with a custom routine, but not the former." <-- [Coke], do you mean that you can't create a custom infix that behaves like the comparator? | 17:37 | |
Geth | advent/main: 0c33485ebb | (Elizabeth Mattijsen)++ (committed using GitHub Web editor) | raku-advent-2024/authors.md Schedule Donald Hunter's post |
17:38 | |
ab5tract | just wanted to make sure that you are implementing a slurpy candidate for such a custom infix routine, if so | ||
ISTR having trouble with reduce unless I provided a slurpy version. | 17:40 | ||
[Coke] | trying... | 17:49 | |
guifa | oh yeah | ||
it does do better with slurpy because of the zero case I think | |||
17:50
yewscion left
|
|||
[Coke] | if I do slurpy, then I can get get the first two args... then I can get the comparator... but then I'm getting 1,2, then True and 3, then True and 4... | 17:51 | |
antononcube | I should have said "slurpy" instead of "listable" ... | ||
[Coke] | so I'm still not able to do the comparison on each two. | ||
so I think I still have to write this with the rotor so I can compare pairwise. | |||
antononcube | @Coke Right, that is why I said that I do no expect reduce to work. | 17:52 | |
[Coke] | Yup. | ||
18:06
sorenson left
18:24
yewscion joined
|
|||
tbrowder | antononcube: re svg i once had an animated svg website that was pretty cool: a model steam loco pulling a couple of cars, working wheels and a blinking road crossing. i built the svg stuff with perl. on my TODO list is to get it running again at raku-rr.net. | 18:42 | |
right now that address is just a redirect... | 18:43 | ||
i should put that code on github... | 18:44 | ||
guifa | [Coke] did you set assoc? | 18:46 | |
m: compare | |||
camelia | ===SORRY!=== Error while compiling <tmp> Undeclared routine: compare used at line 1 |
||
guifa | err | ||
Compare the following | |||
m: sub infix:<`> (*@args) is assoc<left> { say @args }; 1 ` 2 ` 3 ` 4 ` 5 | |||
camelia | [1 2] [True 3] [True 4] [True 5] |
||
guifa | m: sub infix:<`> (*@args) is assoc<list> { say @args }; 1 ` 2 ` 3 ` 4 ` 5 | ||
camelia | [1 2 3 4 5] | ||
guifa | m: sub infix:<`> (*@args) is assoc<chain> { say @args }; 1 ` 2 ` 3 ` 4 ` 5 | ||
camelia | [1 2] [2 3] [3 4] [4 5] |
||
[Coke] | it's a sub, not an operator. | 18:48 | |
though I guess I could make it an operator. | |||
m: sub infix:<WAT>(*@args) is assoc<chain> { @args[0] < @args[1] }; say [[&infix:<WAT>]] <1 2 3 4 3> | 18:50 | ||
camelia | True | ||
[Coke] | ^^ doesn't seem to help there. | ||
guifa | Sometimes the list can be the easier one -- then you can do more complicated logic since you'll access to every single member | 18:52 | |
but you could also maybe do | |||
18:55
sena_kun joined
|
|||
guifa | m: sub foo { say "custom monotonic sub" }; sub infix:<`> (*@args, :$with) is assoc<list> { $with(); say @args }; 1 ` 2 ` 3 ` 4 ` 5 :with(&foo) | 18:56 | |
camelia | custom monotonic sub [1 2 3 4 5] |
||
guifa | basically, you now have an adverb'ed listy operator, so you can do a customized reduction with whatever function (obviously changing the interior of those subs to match the behavior you want) | ||
[Coke] | the list could have hundreds of elements, I'm not going to do individual operators between | 19:02 | |
botato | Coke: I assume it's for today's advent of code, mscha had a clever way: github.com/mscha/aoc/blob/master/aoc2024/aoc02 | 19:08 | |
[Coke] | mmm. | 19:11 | |
19:22
librasteve_ joined
|
|||
librasteve | @antononcube on SVG --- yes please --- take a look at / steal from github.com/librasteve/raku-Math-Po...ns.rakumod for some ideas on objects -> svg | 19:41 | |
19:57
abraxxa-home joined
|
|||
antononcube | @librasteve Ok, but why? š | 20:14 | |
Is better / easier to maintain? Is it more learnable than JavaScript? | 20:15 | ||
[Coke] | I could potentially 3d print an SVG? | 20:16 | |
librasteve | i hear that its very good with LLMs and that you can easily view it in a Chatbook ;-) | 20:20 | |
20:28
Aedil left,
sjn left
|
|||
antononcube | @Coke I was doing a search earlier to today about 3D plots with/via SVG. | 20:31 | |
20:49
sena_kun left
21:05
destroycomputer- is now known as destroycomputers
|
|||
xinming | m: my @x = [1, [2], [], [3]]; @x.grep({ $_ ~~ Positional and $_.elems > 0 }).raku.say; | 21:07 | |
camelia | ($[2], $[3]).Seq | ||
xinming | Is there a better version for $'_ ~~ Positional' please? | 21:08 | |
ab5tract | xinming: best I could think of was to leverage signatures | 21:20 | |
m: multi predicate(@ where * > 0 --> True) {}; multi predicate($ --> False) {}; my @x = [1, [2], [], [3]]; @x.grep(&predicate).raku.say; | |||
camelia | ($[2], $[3]).Seq | ||
21:20
eseyman left
|
|||
nahita3882 | we can combine that idea with duckmap | 21:28 | |
m: my @x = [1, [2], [], [3]]; say gather @x.duckmap(-> @a where ?* { take @a } ) | |||
evalable6 | ([2] [3]) | ||
ab5tract | nahita3882: nice one :) | 21:29 | |
nahita3882 | signature can also be @a [$, |] by using destructuring | 21:30 | |
which says I want at least one element (name of which is not imperative) | |||
thank you ab5tract! | 21:34 | ||
21:39
Manifest0 joined
|
|||
ab5tract | m: my @x = [1, [2], [], [3]]; say gather @x.duckmap(-> @a [$,|] { take @a } ) | 21:45 | |
camelia | ([2] [3]) | ||
ab5tract | wicked! | ||
I dig that that this version doesn't itemize. In practice it probably doesn't matter much when itemization has occurred, but after implementing `is item`, I have come to appreciate the distinction | 21:46 | ||
nahita3882 | oh yeah, i guess that's due to accepting it as @a, so either we can take $@a or for the latter, we can do $a [$, |] | 21:50 | |
22:00
zetaaaa left
|
|||
i've been bitten by itemization mostly when iterating over Hash of Arrays/Hashes of ... when these guys keep them singly, then I put <> here and there until it works :y | 22:01 | ||
22:15
ashfield left
22:21
yewscion left
22:34
ecocode left
22:36
ecocode joined
22:45
Sgeo joined
23:13
kst`` joined
23:17
kst left
|
|||
coleman | antononcube: the docs site has a build step that requires graphviz to make svgs. they look nice, but a custom alternative would be welcome | 23:24 | |
23:27
donaldh_ joined
23:28
donaldh left
23:32
abraxxa-home left
|
|||
antononcube | Yeah, of course. It is interesting point. BTW, PlantUML also uses Graphviz DOT. | 23:59 |