This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
01:51 MasterDuke joined 02:17 teatwo joined 02:19 teatime left 03:31 Heptite left 08:05 p6steve left 09:21 habere-et-disper joined
habere-et-disper I was expecting zero: 09:23
m: say ().min
camelia Inf
Nemokosch Imo zero is a much worse expectation than Inf but even Inf is troublesome 09:25
github.com/Raku/problem-solving/issues/354 09:26
habere-et-disper (y) 09:27
Nemokosch I think these corner cases are usually defined (in math as well) in a way that you can apply the essential operation even between the "zeroeth"/default element and the first element added 09:29
so the product of 0 numbers is 1 because 1*x will be the "product" of x
the sum of 0 numbers is 0 because 0+x will be the "sum of x" 09:30
and similarly the minimum of 0 numbers is positive infinity because the smallest of positive infinity and x will be the "smallest of x"
lizmat and vice-versa for .max 09:31
m: say ().max
camelia -Inf
Nemokosch the problem I see here is rather that 0 somethings cannot be assumed to be 0 numbers in Raku
strings can be ordered but the smallest of zero things is most definitely not positive infinity; arguably something like that doesn't even exist, the abstraction cannot be extended 09:32
tbrowder__ hi, if i have a sub like this: "sub foo(Str $s?, :$kern) {...}" and inside the curlies i call another sub, say "bar", with the same signature, how can i write that bar call inside foo? i read the docs, and i have done it successfully before with other subs, but am not certain how to handle the optional $s 10:47
Nemokosch Does something like foo(|args = :(Str $s?, :$kern)) not work? Not sure about the exact syntax but you get the idea... 10:54
In particular maybe it should be without the = and the colon 10:55
tbrowder__ m: sub b($s?, sub f($s?, :$k) { bar 11:04
camelia ===SORRY!=== Error while compiling <tmp>
Invalid typename 'sub' in parameter declaration. Did you mean 'Sub'?
at <tmp>:1
------> sub b($s?, sub⏏ f($s?, :$k) { bar
tbrowder__ arg, i'll practice at home some more. thnx
i got it working 11:32
i'm confusing working with multi methods, using a single signature for different subs works fine 11:41
11:41 habere-et-disper left
Nemokosch hm, I'm not sure what the goal was 11:47
but in case anybody is interested: sub funky(|all (Str $optional?, :$named)) is valid, after all, and then you can refer to the whole capture as all, or pass it to another function as f(|all) 11:48
12:26 jgaz left, jgaz joined
tbrowder__ then is |c the same thing (i.el., the bare text after the | is not unique)? 13:46
iow, it could be |a or |foobar 13:47
Nemokosch what does iow mean? 13:50
lizmat in other words 13:51
tbrowder__ : yes, the "c" is a sigilless identifier
could be "a" or "foobar" 13:52
tbrowder__ great, thanks to you both 13:53
sorry, "iow" =
= in other wods 13:54
*words
Nemokosch 👍 14:00
14:16 tea3po joined, tea3po left 14:17 tea3po joined 14:19 tea3po left, teatwo left, tea3po joined
tbrowder__ back, eaample Nemokosch is using is not what i originally showed. the bar sub is independent and defined outside foo. 14:46
but their signatures are the same (not their definitions). os, is there a clever way to pass the args other than just repeating them in the call 14:47
lizmat no, there currently isn't really 14:48
tbrowder__ e.g., sub foo($s?, :$kern) { bar($s, :$kern); } 14:49
lizmat well, what Nemokosch showed 14:51
" but in case anybody is interested: sub funky(|all (Str $optional?, :$named)) is valid, after all, and then you can refer to the whole capture as all, or pass it to another function as f(|all)" 14:52
tbrowder__ ok, that's what my tests showed. however, i have had probs unpacking foo's args to pass to a multi
say i have "multi foo($s?, :$kern){}" and "multi foo($s, $a?, :$kern)" 14:55
are those valid multi signatures?
if so, how do i call on multi from the other?
*one 14:56
ok, now i see that construct Nemokosch passed answers the second part of my example. i'm not sure that's in the docs that clearly 15:00
but how about the first part, is it a valid multi? 15:01
(of my second example)
given "multi foo($s?, :$kern) {...}" and "multi foo($s, $a?, :$kern) {...}", are they valid multi signatures? 15:03
Nemokosch how are you planning to disambiguate calls with one positional argument? 15:07
tbrowder__ that answers the question then: it's not a valid multi example 15:16
thank you Nemokosch and lizmat for helping me understand signatures much better! 15:17
Nemokosch I don't know what will happen, to be honest; all I know is that it seems conceptually problematic 15:19
15:28 Heptite joined 15:58 habere-et-disper joined 16:49 habere-et-disper left 16:57 jumpnbrownweasel joined 17:05 tea3po left 20:16 deoac joined 20:41 jumpnbrownweasel left 21:20 teatime joined
tbrowder__ yes, i expected that 21:47
22:44 Ebudae joined 22:47 Heptite left