🦋 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.
00:19 jpn joined
Xliff SmokeMachine: Well... to start with: what methods must be implemented for a Red Database driver? 00:20
That should get me started. 00:21
00:22 Xliff left
SmokeMachine Cliff: There are 2 examples of drivers on Red: github.com/FCO/Red/blob/master/lib...Pg.rakumod and github.com/FCO/Red/blob/master/lib...te.rakumod 00:24
00:24 jpn left
SmokeMachine .tell Xliff There are 2 examples of drivers on Red: github.com/FCO/Red/blob/master/lib...Pg.rakumod and github.com/FCO/Red/blob/master/lib...te.rakumod 00:25
tellable6 SmokeMachine, I'll pass your message to Xliff
SmokeMachine .tell Xliff but basically, the main method that needs to be implemented it the `translate` one. But it’s implemented on CommonSQL driver. 00:29
tellable6 SmokeMachine, I'll pass your message to Xliff
01:19 Aedil joined 01:25 hulk joined 01:26 kylese left 01:37 undoencalma joined 01:46 undoencalma left 01:47 jpn joined 01:53 jpn left 02:15 hulk left, kylese joined 02:39 jpn joined 02:44 jpn left 04:09 jpn joined 04:14 jpn left 04:29 stanrifkin joined 04:30 kylese left 04:34 kylese joined 04:43 maylay left 04:46 maylay joined 05:12 jpn joined 05:17 jpn left 05:30 kylese left 05:31 kylese joined 06:11 undoencalma joined
undoencalma i was thinking... nixos and raku maybe can do a good synergy? cause the common declaration nature of both 06:12
06:23 undoencalma37 joined 06:24 undoencalma37 left, undoencalma left 06:40 Sgeo left 06:50 jpn joined 06:55 jpn left
SmokeMachine unde 07:14
undermine: I was studding about that when I got the idea for writing this: github.com/FCO/Configuration 07:15
07:28 melezhik joined
melezhik o/ 07:28
for people doing golang/GRPC beside raku, I've created sparrow plugin to parse/dump types from proto file - sparrowhub.io/plugin/proto-parser/0.000003 07:29
07:33 Aedil left 07:46 jpn joined 07:54 jpn left 08:00 dakkar joined 08:06 bdju left 08:08 bdju joined
melezhik. .tell tonyo - I’ve got email from fez - Error reading META from your last upload, though my distro meta is valid and local zef run said no complaints when I did fez upload 08:20
tellable6 melezhik., I'll pass your message to tonyo
melezhik. Module - Tomtit
0.1.33
melezhik zef -> fez 08:21
so with all being said, Tomtit new version has not yet showed up in rakuland - maybe i just need to wait a bit more .. 08:22
08:28 jpn joined
melezhik so I run fez upload second time 08:44
let
see
.tell tonyo: ok - now i have got the same email from fez with the same error ... looks my distro is not being handled at the moment 08:46
tellable6 melezhik, I'll pass your message to tonyo
08:47 melezhik left 08:59 lichtkind joined, Aedil joined 09:13 Aedil left 09:16 Aedil joined
Voldenet tbrowder: I was experimenting with something like this 0x0.st/8_dF.raku but in that case the next "prompt" gets the contents of previous input, so it might be necessary to handle raw input instead 09:26
I think the most sane solution would be probably ncurses + nodelay + getch, but it'd be very non-portable I suppose 09:32
hm, I see that curses has "timeout" function, I've never used it though 09:36
10:27 bbkr joined, lichtkind left
bbkr m: sub foo ( --> Hash of Str ) {  my %h = "foo" => "bar"; return %h }; foo(); 10:27
camelia Type check failed for return value; expected Hash[Str] but got Hash ({:foo("bar")})
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1
bbkr Is this a bug? I'm seriously confused by error message here... 10:28
tbrowder Voldenet: thank you very much! a lot to digest. my module update needs releasing, so i'll keep that code to exper with later. i'll go back to a simple yes/no (or forced quit) for now. 10:36
10:46 lichtkind joined
Voldenet welp, I don't know if timeouting prompt is a good idea at all, I've seen it a few times and it was never nice 11:27
bbkr: the hash you're returning doesn't have Str as values, but Mu 11:35
m: sub foo ( –> Hash of Str ) {  my %h = "foo" => "bar"; say %h.of; return %h }; foo();
camelia ===SORRY!=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> sub foo ( <HERE>–> Hash of Str ) {  my %h = "foo" => "ba
11:36
Voldenet m: sub foo ( --> Hash of Str ) { my %h = "foo" => "bar"; say %h.of; return %h }; foo();
camelia (Mu)
Type check failed for return value; expected Hash[Str] but got Hash ({:foo("bar")})
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1
Voldenet you can solve this by specifying value type
m: sub foo ( --> Hash of Str ) { my Str %h = "foo" => "bar"; say %h.of; return %h }; foo();
camelia (Str)
timo bbkr: hey did you see my stackoverflow response to your question about gather/take + race? (i'm proud of it haha) 11:49
grondilu Hello. 11:50
I'm trying to use `shell` instead of `qx{}` and I'm having difficulties. I only get the first line of the output? 11:51
example: `say .out.slurp given shell "date |tac", :out`
what am I missing?
lol sorry I was thinking of 'cal', not 'date' 11:54
my bad
12:05 jpn left
bbkr Voldenet: Thanks. Indeed I forgot that returned value must be declared with type. I think this deserves LTA error message GH issue, because for Arrays this is explicitly explained to user: "Type check failed for return value; expected Array[Str] but got Array (["foo"]).  You have to pass an 12:23
explicitly typed array, not one that just might happen to contain".
github.com/rakudo/rakudo/issues/5845 12:30
timo: Wow, that is solid chunk of knowledge. I'll read it carefully after my $dayjob. Huge thanks! 12:32
12:42 JimmyZhuo joined 12:46 lichtkind left 12:54 bbkr left 13:21 jpn joined 14:02 JimmyZhuo left 14:26 lichtkind joined 15:10 derpydoo joined
tonyo melezhik: can you send me the dist and tell me, how are you bundling it? 15:32
tellable6 tonyo, I'll pass your message to melezhik
grondilu m: print qq{2+2 = {2+2}} 16:51
camelia 2+2 = {2+2}
grondilu ^?
m: print qq[2+2 = {2+2}]
camelia 2+2 = 4
[Coke] Nothing in the docs about { being special as bounding character. 17:00
17:00 jpn left 17:02 dakkar left 17:18 derpydoo left 17:21 Aedil left 17:27 jpn joined 17:59 Aedil joined 18:01 sena_kun joined 18:03 sena_kun left 18:04 sena_kun joined 18:06 sena_kun left 18:07 sena_kun joined 18:22 Aedil left 18:39 jpn left
grondilu how can I pass a slurpy list of pairs to a sub? 19:09
without them being interpreted as named arguments, that is. 19:10
ugexe i must not understand because the obvious thing does that 19:14
m: sub foo(*@_, :$c) { say @_.raku; say $c.raku }; my @pairs = a => 1, b => 2, c => 3; foo(|@pairs)
camelia [:a(1), :b(2), :c(3)]
Any
grondilu but you can't pass them as literals, can you? 19:48
m: print (:foo<bar>) ~~ :(*@)
camelia False
grondilu m: print (+:foo<bar>) ~~ :(*@)
camelia Cannot resolve caller Numeric(Pair:D: ); none of these signatures matches:
(Mu:U \v:: *%_)
in block <unit> at <tmp> line 1
grondilu m: print ((:foo<bar>,)) ~~ :(*@) 19:49
camelia False
grondilu isn't there an indempotent operator for pairs?
19:49 lizmat_ left
grondilu *idempotent 19:49
19:49 lizmat joined 19:50 jargan is now known as jast
grondilu m: print (:foo<bar><>) ~~ :(*@) 19:50
camelia False
grondilu m: print ($(:foo<bar>)) ~~ :(*@)
camelia False
grondilu m: print ("foo") ~~ :(*@)
camelia False
grondilu damn it 19:51
m: print ("foo",) ~~ :(*@)
camelia True
grondilu m: print (:foo<bar><>,) ~~ :(*@)
camelia False
[Coke] m: sub foo(*@_, :$c) { say @_.raku; say $c.raku}; foo(|(:foo<bar>,:baz<frob>)); 19:56
camelia [:foo("bar"), :baz("frob")]
Any
[Coke] literals like that? ^^
19:58 Aedil joined
grondilu well yes that works 20:00
m: print (|(:foo<bar>,)) ~~ :(*@)
camelia False
grondilu hum
oh well
[Coke] ah, you mean in a Signature Literal. Yes, I do not know the magic syntax there. 20:07
m: dd (:(|:foo<bar)).^name 20:08
camelia ===SORRY!=== Error while compiling <tmp>
Invalid typename 'foo' in parameter declaration.
at <tmp>:1
------> dd (:(|:foo<HERE><bar)).^name
[Coke] m: dd (:(1,2,3).^name
camelia ===SORRY!=== Error while compiling <tmp>
Unable to parse expression in parenthesized expression; couldn't find final ')' (corresponding starter was at line 1)
at <tmp>:1
------> dd (:(1,2,3).^name<HERE><EOL>
expecting any of:
sta…
[Coke] m: dd (:(1,2,3)).^name
camelia "Signature"
[Coke] m: dd (:(:foo<bar>)).^name 20:09
camelia "Pair"
[Coke] m: dd (:(|:foo<bar>)).^name
camelia ===SORRY!=== Error while compiling <tmp>
Invalid typename 'foo' in parameter declaration.
at <tmp>:1
------> dd (:(|:foo<HERE><bar>)).^name
[Coke] I think the flatten only works when *calling*, not when declaring a literal sig
grondilu anyway, unrelated : I want to write initialization code with %?RESOURCES. I thought I could put it in the INIT phaser but that does not seem to work. 20:10
funny enough, it does work if I do `$ raku -I. -MFoo -e ''` but not if I do `$ raku -I. lib/Foo.rakumod` 20:12
though maybe in the later case it just ignores the META file? 20:13
ugexe correct 20:18
er
sorry i thought you said -I. vs -Ilib
anyways one reason there might be a different in what you posted is the former is using precompiled Foo whereas the later is not 20:19
[Coke] I wouldn't expect -I. lib/Foo.rakumod shouldn't work, no. 20:25
Be interested to see what the error is, though. 20:26
ugexe unit module Foo; 20:27
INIT my $got = %?RESOURCES<a.txt>.slurp(:close);
say $got;
seems to work for me
(thats with `raku -I. -MFoo -e ''`) 20:28
grondilu well, I have weird errors when trying to use INIT anyway. I get "missing or wrong version" etc right after I try to add this phaser. 20:44
or maybe it's %?RESOURCES inside the init. I'll try with a simple INIT say "hi"; 20:45
yup, a simple `INIT say "hi"` does not cause any issue.
unrelated: 20:47
m: print sub { once { return rand } }() xx 3 20:48
camelia 0.8639341234891338 0.8276875716280019 0.8563044701468159
ugexe if you post all the actual code you'll get a better answer
grondilu well it's not pushed yet
and hard to golf
antononcube I was dealing with INIT and %?RESOURCES while programming initialization cells and/or code for "Jupyter::Chatbook". Too much interesting behavior using INIT, so, I came up with a different solution. 20:49
ugexe not asking for a golf
grondilu well it's about this commit : github.com/grondilu/chess/commit/d...48f2233cd4 20:51
I wanted to put the code of &transmit-data into INIT. Got weird. 20:52
antononcube: noted
[Coke] m: sub a { once { return rand} }; print a() xx 3;
camelia Use of uninitialized value of type Mu in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful.
0.6045143707206804 in block <unit> at <tmp> line 1
Use of uninitialized value of type Mu in st…
[Coke] m: sub a { once { return rand} }; dd a() xx 3; 20:53
camelia (0.17864174774684594e0, Mu, Mu).Seq
[Coke] You might be getting 3 anonymous subs there?
grondilu ah good catch
m: print (state & = sub { once { return rand } })() xx 3 20:54
camelia No such method 'CALL-ME' for invocant of type 'Callable'
in block <unit> at <tmp> line 1
grondilu m: print (state $ = sub { once { return rand } }).() xx 3
camelia No such method 'CALL-ME' for invocant of type 'Any'
in block <unit> at <tmp> line 1
grondilu hum
anyhow so I can indeed use once to mean "run this but only once ever" 20:55
it's not just for loops, then.
that's going to be a substitute for INIT 20:56
ugexe once does not mean use this only once ever
antononcube @grondilu &transmit-data should work; I use similar construct in "LLM::Prompts".
ugexe it is per closure clone
antononcube You can have a package-private variable that has keeps the ingested resources data. (And if not Nil, return it.) 20:57
ugexe it is also note thread safe
not^
state is not thread safe either, and thus cannot guarentee only-once
grondilu antononcube: you're right. kind of weird, though. 20:58
librasteve m: ({ once 42.say } xx 3).map: {$_(), $_()};
evalable6 Cannot test fd7d18088c1141c4a3bd77ec05b7a7cc39e4acee (Commit exists, but an executable could not be built for it)
linkable6 (2025-04-09) github.com/rakudo/rakudo/commit/fd7d18088c RakuAST: skip macro tests if running on RakuAST
Raku eval 42 42 42
librasteve docs.raku.org/language/control#once
ugexe it also seems wrong to put something with side effects (e.g. print) inside a INIT etc type phaser
grondilu nope, "Missing or wrong version of dependency" again. After just a small edit. 20:59
ugexe: the side effect is loading image data into Kitty's terminal. To me that's an initialization thing. 21:00
ugexe missign or wrong version is precomp issues 21:01
grondilu yeah everytime I get this message I have to remove my .precomp files.
otherwise I can't run anything anymore.
librasteve SmokeMachine: sorry I only have a couple of mins to dip in today - please can we continue our discussion over in the Discuss Issue I made? (also since its a public repo, this is open to all I guess) 21:06
ugexe if you want the code to just run once then use a lock
SmokeMachine librasteve: no! I did! There is a question for you there. :) 21:07
s/no/hi/ 21:08
ugexe my $foo-lock = Lock.new; my $foo-cache; sub foo() { $foo-lock.protect: { $foo-cache //= do { ... } } };
librasteve lol
SmokeMachine (Sorry, it was a typo or an autocorrection)
21:26 Aedil left
librasteve SmokeMachine: I replied on the Discuss/Issue ... as mentioned thats my top priority ... but I (like you) see that Cro::WebApp::Forms is the next prize and would be cool to figure that out in a way that Red traits can hang together 21:33
patrickb \q 21:35
librasteve huh? 21:36
22:10 maylay left 22:14 sena_kun left 22:16 maylay joined 22:19 donaldh_ joined 22:22 donaldh_ left
grondilu hurray! I managed to display the chessboard without relying on image magick! 22:23
damn that was hard.
it's now only relying on Kitty and control sequences. 22:24
I hopefull that I'll be able to build a full chess app (like with mouse control and all) in the terminal.
[Coke] neat 22:25
grondilu it's gonna be the best terminal application ever :-) 22:28
grondilu pushed 22:29
22:29 Leguy333 joined, Leguy333 left 22:53 Sgeo joined 23:04 kst left 23:26 lichtkind left
tbrowder info: instead of bugging the ppl here about my Proc::Async problem i just got out my copy of brian d foy's excellent "Learning Perl 6." i wish our online docs had similar practical examples. some time ago i asked him about an update and he basically said something to the effect that wasn't feasible given the small size of the raku community. but note brian IS helping with producing raku modules for windows. 23:44