01:32 yewscion joined 01:37 yewscion left 01:52 leedo left, leedo joined
coleman looks great 02:38
02:44 hulk joined, kylese left
timo thanks :) 02:56
03:15 hulk left, kylese joined 04:53 Aedil joined
guifa whoa, has anyone seen this cosmopolitan project? Curious if that could potentially make maintaining a rakudo star release easier cross platform 05:02
tellable6 2024-11-14T11:28:13Z #raku <tbrowder> guifa: my naive answer is put it in bin/
05:45 teatwo left 08:01 Sgeo left 08:42 MoC joined
librasteve ab5tract: I just tried v2.0-beta.28-alpha.1 and got Plugin 'Comma for Raku' (version '2.0') is not compatible with the current version of the IDE, because it requires build 242.* or older but the current build is IU-243.21565.193 09:02
;-(
09:12 teatime joined 09:25 sena_kun joined
Voldenet re cosmopolitan, it's faster than a lot of libc implementations and easier to maintain 09:29
I remember reading about mutexes being faster, which already is promising 09:30
09:44 hellwolf left
xinming m: class T1 { has $.a = "Default"; }; T1.^attributes[0].package.say 09:52
camelia (T1)
xinming Is this example, How do we get the default value for the attribute '$.a' ?
I used T1.^attributes[0].^methods.map({ .say }) to see all methods an attribute has, But no get value kind of logic 09:53
09:55 sena_kun left
Voldenet m: class T1 { has $.a = "Default"; }; .say for T1.^attributes[0].get_value(T1.new) ## of course 10:11
camelia Default
xinming Voldenet: I don't want the T1.new thing. 10:48
10:49 tejr left
xinming If I want to achieve it with T1.new, I don't need this example, Just T1.new.a 10:49
class T1 { has $.a = "Default"; method t ($arg = do { 'get default from .a in T1' }) { $arg.say; }; }; 10:52
BTW, I know I can have shared class variable to do this. something like, class T1 { my $t = "Default"; my has $.a = $t; method t ($arg = $t) { $arg.say; } } 10:53
But I still want to achieve it with fetching the default from class definitions to avoid the shared my $t
m: class T1 { my $t = "Default"; my has $.a = $t; method t ($arg = $t) { $arg.say; } }; T1.new.a.say 10:54
camelia ===SORRY!===
Type 'has' is not declared
at <tmp>:1
------> class T1 { my $t = "Default"; my hasā $.a = $t; method t ($arg = $t) { $arg.s
Malformed my
at <tmp>:1
------> class T1 { my $t = "Default"; myā has $.a = $t;ā€¦
xinming m: class T1 { my $t = "Default"; my has $.a = $t; method t ($arg = $t) { $arg.say; } }; T1.new.a.say
camelia ===SORRY!===
Type 'has' is not declared
at <tmp>:1
------> class T1 { my $t = "Default"; my hasā $.a = $t; method t ($arg = $t) { $arg.s
Malformed my
at <tmp>:1
------> class T1 { my $t = "Default"; myā has $.a = $t;ā€¦
xinming m: class T1 { my $t = "Default"; has $.a = $t; method t ($arg = $t) { $arg.say; } }; T1.new.a.say
camelia Default
Voldenet I'm unsure if it's possible to get that value without creating an object, that's the best I can do 11:01
SmokeMachine m: class T1 { has $.a = "Default"; };Ā  say T1.^attributes.head.build
camelia Default
Voldenet hm 11:02
m: class T1 { has $.a = self; }; say T1.^attributes[0].head.build
camelia
SmokeMachine m: class T1 { has $.a = 21 * 2 };Ā  say T1.^attributes.head.build 11:04
camelia
SmokeMachine I remember there was a way to get the closure and run that to get the valueā€¦ but Iā€™m not remembering it nowā€¦ 11:05
Voldenet m: class T1 { has $.a = BEGIN { 21 * 2 } };Ā  say T1.^attributes[0].build 11:06
camelia 42
Voldenet either way, any attribute from instance can be used 11:07
SmokeMachine Sorry, I was able to replace it but not to get its value (github.com/FCO/ValueClass/blob/mai...umod#L10)ā€¦ I still donā€™t get how the build_plan does thatā€¦ 11:35
(But that was good to remember about that projectā€¦ I have to go back to that soonā€¦) 11:36
Sorry, there Iā€™m changing the type of the attribute container and not the default value, just to make it clearā€¦ 11:41
antononcube What ā€œcosmopolitanā€ ? Where? (Also, who, why, howā€¦) 13:05
ab5tract librasteve: sorry for the naming confusion. That should be solved in beta 28 13:19
I have no idea why it was not set to the latest release tho :( 13:23
xinming SmokeMachine: thanks, that's what I want. 13:32
m: class T1 { has $.a = "Default"; method t ($arg = ::?CLASS.^attributes.head.build ) { $arg.say; }; }; T1.new.t 13:33
camelia Default
antononcube @ab5tract I still get this error with comma-2.0 plugin: > Plugin 'Comma for Raku' (version '2.0') is not compatible with the current version of the IDE, because it requires build 242.* or older but the current build is IU-243.21565.193 13:45
Just downloaded it.
ab5tract Which version did you download?
antononcube "v2.0-beta.28-alpha.1"
ab5tract github.com/ab5tract/comma-plugin/r....0-beta.28 13:46
Iā€™m deleting the alpha as it causing confusion
antononcube Ok.
Same error with v2.0-beta.28 . (Sorry...) 13:47
13:47 hellwolf joined
ab5tract Thanks for trying 13:47
antononcube Would building from the sources help?
ab5tract Their approach to open ended versioning is spread across a bunch of different settings, apparently. Very not cash money of them 13:48
antononcube: Iā€™m honestly not sure, but I somewhat doubt it 13:49
antononcube Ok
ab5tract I wonā€™t have much more time to try to fix it today, but itā€™s just a build setting in case anyone else wants to give it a shot
antononcube Ok. good to know. 13:50
ab5tract Probably this one: github.com/ab5tract/comma-plugin/b...le.kts#L66 13:51
antononcube I am still trying to decide should I make a post about LLMs playing chess (via Raku tools.) How many chess fans are here? Last time I asked a similar question only a couple proclaimed themselves as such. 13:57
xinming What's the best way to alias a class in the packages? 14:10
antononcube Using but , maybe? 14:14
m6locks_ it's more interesting to chess fans than raku fans? chess fans are a larger group of people 14:27
maybe some chess fans even might try raku out after that...
antononcube Hm... good point. 14:28
xinming my constant Name = Str;
antononcube But there are plenty of non-Raku LLM projects with chess. 14:29
14:41 Sgeo joined
ab5tract xinming: thatā€™s the way 14:47
If you want to make an alias import into a scope where a module is used, you will want to supply an export map
14:56 yewscion joined
MoC #imagemagick 14:59
>_> sorry. 15:00
melezhik. 0/ 15:07
I am glad to see that Raku continue to obtain some traction on HN recently - news.ycombinator.com/item?id=42120090 ā€¦
15:20 Guest81 joined, Guest81 left 15:30 Guest45 joined, Guest45 left
librasteve melezhik: I agree ... I try to submit my posts to HN because I think that there is a bit of a "raku is weird" barrier and that more coverage hopefully will result in it being slowly subconsciously normalized 15:40
xinming m: sub combine ($a, $b) { if $a ~~ Int { return [$a, $b]; } [|$a, [$a[0], $b]] } (reduce &combine, 1..5).raku.say; 16:31
camelia ===SORRY!=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> $b) { if $a ~~ Int { return [$a, $b]; }ā [|$a, [$a[0], $b]] } (reduce &combine,
xinming m: sub combine ($a, $b) { if $a ~~ Int { return [$a, $b] }; [|$a, [$a[0], $b]] } (reduce &combine, 1..5).raku.say;
camelia ===SORRY!=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> return [$a, $b] }; [|$a, [$a[0], $b]] }ā (reduce &combine, 1..5).raku.say;
expecting any of:
infixā€¦
xinming m: sub combine ($a, $b) { if $a ~~ Int { return [$a, $b] }; [|$a, [$a[0], $b]] }; (reduce &combine, 1..5).raku.say;
camelia [1, 2, [1, 3], [1, 4], [1, 5]]
xinming In this example, How can we also make the first 1, 2 also in the array? I know it's because of |$a flat the array. 16:32
If we dont' have |$a, We'll have many nested array 16:33
m: sub combine ($a, $b) { if $a ~~ Int { return [$a, $b] }; [$a, [$a[0], $b]] }; (reduce &combine, 1..5).raku.say;
camelia [[[[1, 2], [1, 3]], [[1, 2], 4]], [[[1, 2], [1, 3]], 5]]
16:33 botato joined
xinming I also add logic check for that both first are Int, We keep the array intact, But It seems, the [[1,2]] will also be flatten'ed by |$a 16:33
antononcube @librasteve "[...] HN [...] "raku is weird" [...] being slowly subconsciously normalized" -- Looking at how many comments a recent post about LLMs and chess got, I guess it is a good idea to make a Raku post on the same subject... 16:34
botato with fond memories of perl, I'm finally checking out raku, very interesting. For a test I tried making simple script doing parallel http requests: gist.github.com/bo-tato/d09fbd2ca2...9cfc0d6879 16:35
on some runs it gets moarvm crash, backtrace here: gist.github.com/bo-tato/068753cef8...767a385843 16:36
on other runs sometimes an exception from http user agent internals: gist.github.com/bo-tato/6d407ad733...9db4a89eed
am I using concurrency wrong and doing stuff that's not supposed to be thread safe? or are these bugs? btw I know real way for concurrent network requests in raku would be async client like cro with await, I was just trying to test if raku's "colorless async" was python gevent or ruby style where any code making network requests will automatically 16:39
suspend just that green thread, or if it will block whole system thread if I don't write explicitly async/await code
ab5tract xinming: itā€™s not documented yet (sorry :( ) but I think you might be able to do what you want with multi subs where one has a signature @a is item
*a signature containing 16:40
This prevents flattening of arrays inside of scalar containers
xinming ab5tract: I know the 'multi', It's just feel strange how we can write this kind of reduce function
ab5tract The ā€˜@a is itemā€™ is the important part 16:41
It has to be a multi because you are also sending single Int values in the first arg position 16:42
xinming m: multi combine (@a, $b) { return [|@a, [@a[0], $b]] }; multi combine ($a, $b) { [$a, $b]; }; (reduce &combine, 1..5).raku.say;
camelia [1, 2, [1, 3], [1, 4], [1, 5]]
xinming Even with multi, It doesn't work as expected.
hmm, I'll try some other 16:43
termbin.com/ffgd <--- This seems to be the working version, But I feel a bit lengthy about the (@a[0] ~~ Int and @a[1] ~~ Int) Part 16:56
ab5tract Sorry that I donā€™t have time to explain better but I was speaking of the ā€˜is itemā€™ trait 17:00
17:01 Guest4223 joined
ab5tract Anyway, you can write your above as ā€˜all @a[0,1] ~~ Intā€™ to make it shorter 17:01
17:02 botato is now known as Guest8863, Guest8863 left, Guest4223 is now known as botato
xinming ab5tract: Ok, thanks for the 'is item' trait part, I'll read docs.raku.org 17:02
17:02 botato left
ab5tract xinming: I havenā€™t had a chance to document the feature yet :( 17:02
17:03 ubuntu2 joined
xinming ab5tract: Could you please give example of the snippets then? So I can understand that 17:03
17:05 ubuntu2 is now known as botato
librasteve botato: hi and welcome, glad you can finally try ti. any chance that you can share the version of raku you have (and your OS) raku -v , also if you can gist a code example that triggers the failure I can try and reproduce / resolve it 17:06
oh - just noticed you already pasted the code - sorry! 17:07
botato I just installed rakudo star a couple days ago on linux building from source, raku -v is: Welcome to Rakudoā„¢ Star v2024.10. 17:09
Implementing the RakuĀ® Programming Language v6.d.
Built on MoarVM version 2024.10.
17:09 zetaaaa joined
ab5tract xinming: sure, one moment 17:09
librasteve ok - thanks ... that's odd it works fine on my machine (also Rakudoā„¢ v2024.10) 17:11
the only thing I changed in your code was change ^200^ to ^10` 17:13
please can you try that?
ah - I tried ^200 again and now I see the same error 17:14
botato sometimes it runs fine for me, at least one request get's that http user agent exception most of the time, and the moarvm crash happens maybe 20% of the time 17:16
17:20 teatime left, teatime joined
librasteve this looks like a rakudo bug to me (I can get up to about 50 iterations before hte error creeps in, when it does the code hangs) - maybe a race or some thread deadlock that's way above my paygrade - suggest you raise an issue over at github.com/rakudo/rakudo/issues 17:21
[I am on a M1 mac with a lot of heavy processes right now so maybe you can get closer to 200]
17:22 gordonfish left, gordonfish joined
antononcube @timo See the new package "Graphviz::DOT::Grammar" - raku.land/zef:antononcube/Graphviz...T::Grammar 17:22
@timo It can be used to produce SVG graphics of graph plots. 17:23
librasteve there are other's here who use concurrency in their $day-jobs and they may have more insight ...?
ab5tract xinming: termbin.com/k9pq 17:24
also, thanks for showing me termbin, this looks very handy!
antononcube @timo I am trying to decide should Raku Jupyter notebooks have a built-in DOT magic-cell. 17:26
ab5tract xinming: with comments termbin.com/qtbc 17:28
xinming ab5tract: So, the 'is item' trait is used for ensure all elements in the array is item, So multi will match. Thanks 17:33
ab5tract not exactly
my $a = [1,2]; # will match 17:34
my @a = [1,2]; foo $@a #will match
my @a = [1,2]; foo @a # will not match
this was used to fix an issue with splice
xinming hmm, match things with scalar containers 17:35
ab5tract m: my @a = [1,3]; @a.splice(1, 0, $[2]); dd @a; 17:36
camelia [1, 2, 3]
ab5tract m: use v6.e.PREVIEW; my @a = [1,3]; @a.splice(1, 0, $[2]); dd @a
camelia [1, [2], 3]
ab5tract it can also be used likewise with %hashes
xinming ab5tract: termbin.com is not good for long term snippets, as they'll be deleted for a period, I have many chat log snippets which uses termbin.com and now I lost most of the snippets. Though, through the context, I can know what the code is used for. 17:37
ab5tract ah, I see
still, useful in a pinch, thanks! 17:38
xinming np
ab5tract and thank you also for presenting me with a useful example to use when documenting `is item` 17:40
botato ok thanks, I submitted an issue: github.com/rakudo/rakudo/issues/5683 17:43
btw, if I make the requests async properly with cro, ie: gist.github.com/bo-tato/9b5e49d1f8...34047c348c 17:44
how can I control the max requests at a time? .hyper and .race are nice but I think that would be one request per system thread, where I'd want one green thread per request 17:46
17:48 orangebot joined
ab5tract you could probably do `(^200).rotor($batch-size) -> @batch { await do for @batch { Cro::HTTP::Client.get('httpbin.org/delay/2') } }` 17:49
ab5tract has to stop procrastinating and pack
botato interesting, that would have the issue that it makes $batch-size requests at once, then waits for them all to return before making the next batch, so if just one request in a batch is slow, you will wait for it before sending out any new requests. where we want to always have $batch-size requests pending at any given time 17:53
ab5tract Then I would use react/whenever along with Supply.throttle 17:54
Supply.throttle might even be enough, actually 17:57
18:13 hellwolf left 18:16 yewscion left
botato thanks, yea with Supply.throttle it's nice: gist.github.com/bo-tato/3e273c47aa...d8b01df88b 18:16
18:17 yewscion joined 18:21 sena_kun joined
ab5tract Yeah that looks really clean indeed 18:21
18:22 yewscion left 18:37 yewscion joined
timo botato: github.com/raku-community-modules/...c17aef5758 here's a commit in the URI module that was needed to make URI thread-safe 18:55
i don't see that a release was made from that commit however 18:56
that seems like a thing we should definitely do 18:58
19:40 hellwolf joined 19:42 hellwolf left 19:58 MoC left 20:11 Aedil left 20:32 Guest40 joined 20:35 Guest40 left 21:18 hellwolf joined 21:34 sergio joined
timo antononcube: i'm not a user of raku jupyter at the moment, but my first thought is "yes make that available" haha 22:09
22:36 yewscion left 22:39 euandreh joined 22:41 sena_kun left 23:44 hellwolf left 23:46 sergio left 23:59 hellwolf joined