🦋 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.
tonyo m: my Array[Int] $x .=new; $x.push(2); dd $x # Rog: 00:10
camelia Array[Int $x = Array[Int].new(2)
pelevesque Has anyone here used an AI to generate some Raku code? 00:16
MasterDuke a couple people have mentioned doing it. could search the irc logs to find out exactly who 00:47
guifa Array[Int].new(……) 01:05
tonyo pelevesque: i tried to get gpt to write the deflate algorithm but not much luck with it 02:32
guifa Sweet, all formatters are done but for the named timezone ones. So close 03:02
Voldenet pelevesque: I've tried generating raku code and it notoriously failed in human-like way 07:51
for instance, I've seen this: `sub x(Iterable $iterable) { for $iterable -> $item { … }}` 07:52
also, I've failed to convince chatgpt what does 'lazy' mean, apparently: 08:20
> You are correct that @($input) does not work with lazy arrays. Instead, we can use elems($input) to get the number of elements in $input.
Voldenet otoh, openai requested an api for CArray: `my CArray[epoll_event] $events .= new; $events.elems = 10;` :> 09:40
Anton Antonov @Voldenet Which model of OpenAI are you using? 11:28
Voldenet gpt-4 11:52
Anton Antonov @Voldenet Good to know. I have so far experimented only with GPT-3.5. See here : youtu.be/mI-oWLz5dYY . 12:47
Voldenet btw, it's nice what chatgpt is able to create when you ask it to use nativecall 12:56
Anton Antonov I am more impressed ChatGPT-3.5 generates Raku grammars that work "out of box" : i.imgur.com/lydYleR.png 13:45
Voldenet it can generate some grammars, but not always: pastebin.com/mnQV0Ydz 14:31
you can after some bouncing back and forth get useful result though pastebin.com/wdSYxYSh 14:45
Anton Antonov Right -- I would say some iteration over / with the generated results is expected. 14:57
lizmat And yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2023/04/10/2023-...-patterns/ 17:10
Rog guifa: Array[Str].new, that makes sense. Although I'm still banging my head against the type system because my Positional[Str] %paths-to = @nodes Z=> Array[Str].new xx *; yields an error saying it wanted an Associative[Positional[Str]] but got a Hash. I guess the Hash itself doesn't carry type info? 17:47
Is there any way around that?
I might just get rid of the typing for now because I'm not even sure I'll settle on Str here, but I'm still curious 17:51
Nemokosch % implies associative 18:33
Oh yeah gotcha xD you got the dimension right but the typing would still need an additional layer 18:34
You'd still need to create it as Hash[Positional[Str]] or something... 18:34
I think it's fair to say that there is no type deduction whatsoever 18:35
p6steve m: my Positional[Str] %p = <a b c> Z=> Array[Str].new xx ; 18:40
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Missing required term after infix at /home/glot/main.raku:1 ------> [Str] %p = <a b c> Z=> Array[Str].new xx⏏ ; expecting any of: prefix term
p6steve m: my Positional[Str] %p = <a b c> Z=> Array[Str].new xx *;
Raku eval
p6steve works for me, but possibly I’m missing the point 18:41
Rog Huh, maybe I’m on too old a version 18:59
Nemokosch or too new, even 19:05
this is 2022. 02 or something
p6steve i checked this on repl v2023.02 19:34