🦋 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:09
lichtkind left
01:06
hulk joined
01:07
kylese left
01:48
thowe joined
|
|||
coranila | m: my \sig = :(Int $a, Str $b); proto f(*@, *%) { if (|@, |%).Capture ~~ sig { say "matched" } }; f 1, "foo"' | 02:06 | |
evalable6 | (exit code 1) ===SORRY!=== Error while compilin… | ||
Raku eval | Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Two terms in a row at /home/glot/main.raku:1 ------> e ~~ sig { say "matched" } }; f 1, "foo"⏏' expecting any of: infix infix stopper postfix statement end statement modifier statement modifier loop | ||
evalable6 | coranila, Full output: gist.github.com/935045a401f76f9766...69ff4ceddb | ||
coranila | m: my \sig = :(Int $a, Str $b); proto f(*@, *%) { if (|@, |%).Capture ~~ sig { say "matched" } }; f 1, "foo" # hhh | ||
evalable6 | (exit code 1) ===SORRY!=== Error while compilin… | ||
Raku eval | matched | ||
evalable6 | coranila, Full output: gist.github.com/2665ec59758d6a7021...e6b32c1ccf | ||
Voldenet | m: my \sig = :(Int $a, Str $b); proto f(*@, *%) { if (|@, |%).Capture ~~ sig { say "matched" } }; f 1, "foo" # hhh | 02:07 | |
camelia | ( no output ) | ||
coranila | Xliff: you gotta 1) have the signature accessible at compiile time and need a constant as timo said and 2) need to sidestep normal dispatch because Signatures are for introspection | 02:09 | |
Voldenet: you're throwing away the parameters in the proto and there's no candidate that cares about them | 02:10 | ||
that's "in the proto signature" to be precise; :(@) as a placeholder only says "match this, don't bind" | |||
or rather, <sigil> vs <sigil> <topic> is that distinction, between matching Capture shape and biniding Capture arguments | 02:11 | ||
although i think maybe a functional interface to runtime Routine composition could be cool, not sure what that would look like though | 02:12 | ||
Voldenet | it's the same code you've posted, but on irc, made me quite puzzled because I thought that this should compile | ||
and it indeed compilec | 02:13 | ||
copiled* | |||
coranila | oh! | 02:14 | |
that confirms that discord strips _ | |||
in the bridge somewhere | |||
I used *@_ | |||
and *%_ | |||
in the proto signature | |||
02:15
hulk left
|
|||
but :(*@, *%) | 02:15 | ||
02:15
kylese joined
|
|||
Voldenet | ah, probably because you used it not within code block, so that got interpreted as markdown | 02:15 | |
coranila | yep, i suppose that means i should use code blocks here and rely on the bridge to translate those properly for irc! | 02:16 | |
m: my \sig = :(Int $a, Str $b); proto f(*@_, *%_) { if (|@_, |%_).Capture ~~ sig { say "matched" } }; f 1, "foo" # ? | |||
Raku eval | Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Bogus statement at /home/glot/main.raku:1 ------> <BOL>⏏my \sig = :(Int $a, Str $b); proto f( expecting any of: prefix statement list term ``` | ||
evalable6 | matched | ||
coranila | hmmm | ||
so it's either one or the other | 02:17 | ||
as in, either the bridge gets it right or discord gets it right | |||
...patches welcome? :-) | |||
Voldenet | bridge does the correct thing, I guess, assuming it's text you're using | 02:18 | |
coranila | what else would i be using? speech? images? | 02:19 | |
Voldenet | I mean, uh, if you wanted to actually use markdown, then it translates things properly | 02:20 | |
but markdown collides with code and bridge has no way to know easily | |||
coranila | ah but i dont have the choice of usiing markdown or not if i cannot use code blocks | ||
and usinig code blocks means the discord side bot cant parse iit | |||
Voldenet | indeed, I'd say that discord bot should understand that | ||
coranila | and that's a severe flaw in parity between IRC and discord | 02:21 | |
maybe there's a format i dont know for the discord eval bot shrug | |||
does feel a lot like generational friction, which is confusing because I'm almost 40, I'm an elder millennial, i dont belong to IRC or discord, where's my ICQ password :'-) | 02:22 | ||
Voldenet | i think every irc and discord message should include content-type header, that'd solve it ;) | ||
I bet the bot on `comp.lang.raku.misc` would've handled it better | 02:26 | ||
coranila | no clue; usenet is part of a mysterious ancient past to me personally! | 02:40 | |
03:45
kylese left
03:48
kylese joined
03:59
stanrifkin_ joined
04:02
stanrifkin left
05:45
Aedil joined
|
|||
melezhik. | wayland: thanks for feedback . I have updated the first diagram hopefully to make it more readable. As for svg / UML stuff I intentionally wanted to keep things simple and not going into much details, so I thought that ascii graphics would be just enough and some details are intentionally omitted , so those “pictures” are just visual additions to the text. I have split the first paragraph in the Sparrow | 05:58 | |
section to separate sentences. | |||
06:49
apac left
06:54
Aedil left
07:11
razetime joined
07:12
Guest85 joined
|
|||
wayland76 | Just while we're talking signatures, I realised that queries (generally, but especially in the Logic Programming sense) are the opposite of functions. With a function, you provide definite data (a capture), and the one with the matching signature is returned. With a query, you effectively provide a signature, and the matching data (a Capture) is returned. | 07:19 | |
That's what I was going to try to do with signatures. | |||
(there's more to it than that, but that's a starter 🙂 ) | 07:20 | ||
07:46
[Coke] left
07:48
[Coke] joined
07:50
razetime left
07:53
lichtkind joined
08:15
Guest85 left
08:18
stanrifkin_ left
|
|||
coranila | that sounds like given/gather/when/take to md | 08:39 | |
*me | |||
maybe &categorize, &classify, or &rotor also can do things in that context? | 08:40 | ||
08:47
Aedil joined
09:14
PaulW2U left
|
|||
wayland | coranila: I was thinking that if you had a table called, say, "People", you could do People($name where * ~~ /^A/, $age where * > 30) or something. | 09:23 | |
melezhik: Try this (you may want to tweak it more): Sparrow is a Raku automation framework that provides a full experience for Sparky job developers, without the need for a deep knowledge of Raku. Also, underlying tasks could be written in any of the many languages supported by the framework. The following is a simple diagram of Sparky-Sparrow integration: | 09:27 | ||
coranila | m: class Person { has $.age; has $.name }; given new Person: :39age, name => <crnl> -> $_ { when *.age > 35 && *.name eq "crnl" { say "hey thats me!" }; default { .say } } | 09:30 | |
evalable6 | hey thats me! | ||
coranila | wayland: that look about right? | ||
there's also some unpacking syntax I don't remember right now that lets you put the results of *.name and *.age into a variable for the block directly | 09:33 | ||
something like @($head, *@tail) i think, but maybe that doesn't generalize to arbitrary methods, or at least not easily; as i said, i don't recall the precise syntax :-) | 09:34 | ||
wayland | coranila: Yes, but that's only one person; I'm thinking it would be a collection. I have to admit, I'm kind of avoiding thinking about this until after I sort out Table-Oriented Programming more, because I don't really know Logic Programming (I've read about it, but not done much), and I think I still have more thinking to do about it. | 09:37 | |
I'm wanting to get some of these declarative-type structures into Raku (ie. as Slangs), but haven't got my thoughts nailed down well enough to do it yet :) . | |||
coranila | well you can m %age-groups = @people.categorize({ $_.age div 5 }) or such | 09:38 | |
*my %age-groups | |||
or is that &classify? i admit i'm not 100% on the semantics between those two! | 09:39 | ||
wayland | Yeah, that might end up being the go. | ||
Thanks! | |||
09:53
Sgeo left
|
|||
Voldenet | the diff is that classify groups by single value, categorize puts elements in categories | 09:55 | |
so you can have item in multiple categories | 09:56 | ||
coranila | ah, so classify({.age}) and categorize({ .age div 5 })? | 09:57 | |
Voldenet | e.g. my %groups = @people.categorize({ $_.age div 5, $_.income }) | ||
maybe some concrete example | 09:58 | ||
m: say (^10).categorize({ ($_ %% 2 ?? "even" !! "odd"), ($_ %% 3 ?? |("div 3") !! |()) }) | |||
camelia | {div 3 => [0 3 6 9], even => [0 2 4 6 8], odd => [1 3 5 7 9]} | ||
Voldenet | m: say (^10).classify(*.is-prime) | 09:59 | |
camelia | {False => [0 1 4 6 8 9], True => [2 3 5 7]} | ||
coranila | m: my @ten = ^10; .say for @ten.classify(&so), @ten.classify(.&{+]); | 10:08 | |
evalable6 | (exit code 1) ===SORRY!=== Error while compilin… | ||
Raku eval | Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Prefix + requires an argument, but no valid term found. Did you mean + to be an opening bracket for a declarator block? at /home/glot/main.raku:1 ------> r @ten.classify(&so), @ten.classify(.&{+⏏]); expecting any of: prefix | ||
evalable6 | coranila, Full output: gist.github.com/62e8ef093577250624...ac9e1f5e51 | ||
coranila | ah of course not dotty, silly me .. | ||
m: my @ten = ^10; .say for @ten.classify(&so), @ten.classify(&{+]); | 10:09 | ||
Raku eval | Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Prefix + requires an argument, but no valid term found. Did you mean + to be an opening bracket for a declarator block? at /home/glot/main.raku:1 ------> or @ten.classify(&so), @ten.classify(&{+⏏]); expecting any of: prefix | ||
evalable6 | (exit code 1) ===SORRY!=== Error while compilin… | ||
coranila, Full output: gist.github.com/d0904e048bc32720ad...c82350ebd1 | |||
coranila | oh hm! | ||
m: my @ten = ^10; .say for @ten.classify(&so), @ten.classify(&[+]); # there we go! | 10:11 | ||
evalable6 | {False => [0], True => [1 2 3 4 5 6 7 8 9]} {0 => [0], 1 => [1], 2 => [2], 3 => [3], 4 => [4], 5 => [5], 6 => [6], 7 => [7], 8 => [8], 9 => [9]} |
||
Raku eval | {False => [0], True => [1 2 3 4 5 6 7 8 9]} {0 => [0], 1 => [1], 2 => [2], 3 => [3], 4 => [4], 5 => [5], 6 => [6], 7 => [7], 8 => [8], 9 => [9]} | ||
coranila | that definitely clears up any clarity because i still don't understand the difference between categorize and classify! | 10:12 | |
m: my @ten = ^10; .say for @ten.classify({$_ % 3 }), @ten.categorize({$_ % 3 }) # | 10:13 | ||
evalable6 | {0 => [0 3 6 9], 1 => [1 4 7], 2 => [2 5 8]} {0 => [0 3 6 9], 1 => [1 4 7], 2 => [2 5 8]} |
||
ab5tract | It boils down to the optional named args, I guess | 10:22 | |
lol, not really | 10:24 | ||
I didn’t look super closely but they appear at first glance to take the same optional arguments…. | |||
melezhik. | wayland: thanks - will use this | 11:19 | |
11:46
floyza joined
|
|||
librasteve | @coranila for discord m: operation, I recommend using backticks at start end of the code (ie after the m:) | 12:23 | |
this seems to be not too annoying for IRC onlookers | 12:24 | ||
Discord is also good for multiline code with triple backticks ... but I suspect this could be painful over on IRC | |||
coranila | this makes the bot on discord misunderstand the line, doesnt it? | 12:25 | |
at least under markdown edge cases | |||
that's why i use `` at all after all | 12:26 | ||
librasteve | m: say 'yo'; | ||
evalable6 | yo | ||
Raku eval | yo | ||
librasteve | i've never seen that with backticks | ||
(iiuc) | 12:27 | ||
coranila | here | 12:31 | |
12:36
lichtkind left
13:20
human-blip left
13:22
human-blip joined
14:00
lichtkind joined
15:07
wayland76 joined
15:08
wayland left
15:23
lichtkind left
|
|||
grondilu | .seen antoncube | 15:25 | |
tellable6 | grondilu, I haven't seen antoncube around, did you mean antononcube? | ||
grondilu | .seen antononcube | ||
tellable6 | grondilu, I saw antononcube 2025-05-06T16:33:34Z in #raku: <antononcube> @lizmat I was joking for the "wind direction." The use of "Map::Match" was suggested by you at some point when discussing the emojis package. | ||
grondilu | antononcube uses raku through JupyterLabs I think. Is that 'github.com/bduggan/raku-jupyter-kernel' or is there a better one? | 15:26 | |
15:32
wayland76 left
15:35
wayland76 joined
15:39
AlexDaniel joined
16:35
razetime joined
|
|||
librasteve | yeah Jupyter::Kernel (bduggan) is the base code, @antononcube developed that to Jupyter::Chatbook and added lots of LLM prompt engineering goodies | 16:42 | |
16:46
lizmat joined
|
|||
Geth | ecosystem: c97f7c5e81 | (Elizabeth Mattijsen)++ | META.list Brian Duggan's modules don't live here anymore They are either on the zef or CPAN ecosystems |
16:51 | |
17:15
apac joined
17:28
stanrifkin joined
18:15
lizmat left
18:35
AlexDaniel left
|
|||
grondilu | librasteve: noted | 18:36 | |
18:48
lizmat joined
18:49
lizmat left,
lizmat joined
19:28
apac left
19:32
Sgeo joined
|
|||
Xliff | coranila: So Signatures are for a specific use case rather than a generic one. That seems like a waste of potential, but that explains alot. | 19:37 | |
My whole point is that I would like sub definitions to be reusable for NativeCall function pointers. There is no usable way to say: "sub c_callback ( uint32, &func (uint32, gpointer, gpointer --> gboolean) ) is native..." | 19:38 | ||
You always have to specify that signature every time. | |||
It makes NativeCall's use in large callback-involving projects (which is every GUI toolbox out there) a lot more dicey than it needs to be. | 19:39 | ||
19:40
guifa joined
19:59
lizmat_ joined,
lizmat left
20:01
apac joined
20:05
Xliff left
20:31
lizmat_ left,
lizmat joined
20:54
lizmat left,
MasterDuke joined
20:55
lizmat joined
21:35
Aedil left
22:06
lizmat left
22:09
MasterDuke left
|
|||
coranila | Yeah, there's a bit of a pit around Routine and Callable and the type system and such | 22:28 | |
I'm not sure if Signature was planned to be constructive originally - i'd think so, but maybe not - from what I know, internally Signatures are for introspection and trial binding and not for object definition | 22:29 | ||
This kind of relates to my thoughts about how the type system is missing a third bottom, but that's a completely different pile of what | 22:31 | ||
I do reserve the right to sound overly confident and saying someting wrong because I did not verify in advance, in any case 0:-) | 22:32 | ||
22:56
floyza left
23:12
silug7 joined,
floyza joined
23:18
silug left,
oodani left,
sftp left,
dpk left,
atweedie left,
silug7 is now known as silug
|
|||
made me think of &wrap vs &assuming, and how the latter seems to be irreversible such that we cannot decompose the priimed anon into the original Routine and arguments | 23:21 | ||
which probably could be solved on the same layer, by extending Signature such that it functions as a functional interface for declaration as well? | |||
which i think is what we're doing during trial bind anyway, but opaquely vis the HLL | 23:22 | ||
hmm, that however does seem to lead back to the missing explicit bottom type for the &-space | 23:23 | ||
23:24
oodani joined,
dpk joined,
atweedie joined
23:32
apac left
|
|||
antononcube | @grondilu I was traveling… Raku Jupyter notebooks can be used in JupyeterLabs, but since I cannot make JavaScript plots there, I use Jupyeter notebooks in VSCode. | 23:41 |