🦋 Welcome to the former MAIN() IRC channel of the Raku Programming Language (raku.org). This channel has moved to Libera (irc.libera.chat #raku)
Set by lizmat on 23 May 2021.
tonyo i never know if he's gone. 03:56
moon-child I know it's been discussed to death already, but I still find it somewhat irksome that this is intended behaviour 04:51
m: sub infix:«<>»(Int $a, Int $b) { $a != $b }; say (5|6) <> (6|8); say (5|6) != (6|8);
camelia any(any(True, True), any(False, True))
False
Geth doc: b80ace8118 | rir++ (committed by Juan Julián Merelo Guervós) | doc/Language/regexes.pod6
Update regexes.pod6

Change "two vowels together after a C<:>" to "multiple characters after a C<:>".
Both 'vowels' and 'two' are too restrictive.
06:17
linkable6 Link: docs.raku.org/language/regexes
Geth doc: 4b25dbbc7d | (Stoned Elipot)++ (committed by Juan Julián Merelo Guervós) | 2 files
Document Str.samecase

  ... and state that Cool.samecase uses it.
06:18
doc: 9e382bc0c2 | (Stoned Elipot)++ (committed by Juan Julián Merelo Guervós) | 2 files
Add Real.{Int,Num,Rat} coercers ref #3782

  ... and remove non-existent Numeric.{Int,Num,Real} ones
doc: acd9065d3f | (Stoned Elipot)++ (committed by Juan Julián Merelo Guervós) | doc/Type/Real.pod6
Avoid repetitions
lizmat clickbaits rakudoweekly.blog/2021/06/14/2021-24-missing/ 07:39
moon-child clicks
moon-child m: say -1 .abs 08:12
camelia 1
moon-child m: say 1/2 .numerator
camelia No such method 'numerator' for invocant of type 'Int'. Did you mean
'iterator'?
in block <unit> at <tmp> line 1
lizmat that feels weird 08:13
m: my $a = 1/2; say $a .denominator # feels like some kind of parsing issue 08:14
camelia 2
moon-child it's parsing as 1 / (2.numerator) 08:15
(I assume--)
lizmat m: dd 1 + 4 .Str # looks like it's more general 08:17
camelia 5
lizmat note that that's an Int, not a Str 08:19
moon-child m: dd ~5 .Int 08:20
camelia 5
lizmat yeah, so prefix ops bind tighter
moon-child for some reason I had assumed that it was special-cased for prefix - and /, so you could call methods on negative numbers and rats with less noise. But the more I think about it the less sense that makes 08:21
*and infix /
Geth doc: 8335be8cf5 | (Stoned Elipot)++ | doc/Language/101-basics.pod6
Add (missing) whitespaces

  ... or else the spell test (xt/aspell.t) fails
10:46
linkable6 Link: docs.raku.org/language/101-basics
Altreus I found myself in a wholesome discussion on r/raku about the use of reduce, and I learned that I'm getting things right without fully understanding them 10:53
This means that raku is behaving like I expect
I also learned that a thing I wanted is an option :D
lizmat :-) 10:55
/r/raku ?
Altreus er /r/rakulang isn't it
that seems right
Geth doc: f6023dac67 | (Stoned Elipot)++ | 2 files
Switch to Doc::TypeGraph
11:43
Geth doc/num-str: c3de886399 | (Stoned Elipot)++ | doc/Type/Num.pod6
Document Num.Str
14:03
doc: stoned++ created pull request #3899:
Document Num.Str
Doc_Holliwood oi 16:58
if you remove the joins from my tweet here twitter.com/HrBollermann/status/14...6995890178
ah nevermind
ah nevermind 16:59
Altreus OK I'm gonna be streaming some API::Discord dev tomorrow night against my better judgement 17:46
Excessive being smarter than me will be frowned upon
codesections ha. Altreus, if I ever do something like that, excessive-being-smarter-than-me will be *strongly encouraged* 17:53
Altreus no you see
I'm going to need some
Altreus In fact quite a lot 17:53
The cup runneth dry
but you know, it is bad manners to make the streamer cry
codesections ha. (there's a "stream of tears" joke somewhere just out of my reach) 17:54
Altreus elusive humour 17:55
Anyway it'll be in 24 or 25 hours from now, depending on how I'm feeling
codesections cool
tonyo schrödinger's joke
Altreus heisenlol
that's enough IRC for today. TTFN 17:56
codesections It seems like the Raku take on "heisenlol" would be eigenlol, fwiw 17:58
xinming releasable6: status 18:59
releasable6 xinming, Next release in ≈4 days and ≈0 hours. 1 blocker. 0 out of 17 commits logged 18:59
xinming, Details: gist.github.com/7e16dbcd4fee5b8cf4...2d2e70e404
codesections What's the syntax for a function that returns a function with a specified signature? 19:06
m: sub f(Int $a --> Callable:(--> Int)) {...} # doesn't work
camelia 5===SORRY!5=== Error while compiling <tmp>
Malformed return value (return constraints only allowed at the end of the signature)
at <tmp>:1
------> 3sub f(Int $a --> Callable7⏏5:(--> Int)) {...} # doesn't work
xinming m: sub f (Int $a --> &code:(--> Int)) { ... } 19:14
camelia 5===SORRY!5=== Error while compiling <tmp>
Malformed return value
at <tmp>:1
------> 3sub f (Int $a -->7⏏5 &code:(--> Int)) { ... }
xinming m: sub f (Int $a --> &(--> Int)) { ... } 19:15
camelia 5===SORRY!5=== Error while compiling <tmp>
Malformed return value
at <tmp>:1
------> 3sub f (Int $a -->7⏏5 &(--> Int)) { ... }
codesections (That last one is the syntax I'd _like_ to be able to write) 19:18
xinming yea, I'm trying too, I want to know the answer too. 19:19
codesections sub f(Int $a --> Code where { $_ ~~ :(--> Int)}) {...} # maybe it's NYI? 19:20
m: sub f(Int $a --> Code where { $_ ~~ :(--> Int)}) {...} # maybe it's NYI?
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot do non-typename cases of type_constraint yet
at <tmp>:1
------> 3nt $a --> Code where { $_ ~~ :(--> Int)}7⏏5) {...} # maybe it's NYI?
19:21
xinming m: sub f (Int $a --> Code where .signatures ~~ :(Int) ) { ... } 19:22
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot do non-typename cases of type_constraint yet
at <tmp>:1
------> 3$a --> Code where .signatures ~~ :(Int) 7⏏5) { ... }
xinming yea, this is where I got too.
the answer
Can we see rakudo finish all these features before we die?
MasterDuke 99% sure it is implemented, i thought there was an example in the docs? 19:23
gfldex Do you intend to get 100 years old?
Raku is designed to be a moving target. 19:24
codesections MasterDuke: I see examples for return types and for callables, but not for returned callables (though I'd love to be wrong!) 19:25
gfldex codesections: did you check Roast? 19:27
MasterDuke docs.raku.org/type/Signature#Const..._Callables the first example here isn't what you want?
codesections No, that takes a callable &l with the signature :(Int:D --> Int:D) but doesn't constrain the type of the callable returned by &apply 19:28
gfldex: no -- good idea, though, checking now 19:29
codesections gfldex: From a quick look at Roast, I'm sticking with the idea that constraining the signature of a returned Callable is NYI – for one thing, constraining the signature of a Callable parameter is tested in "closure-parameters.t", and there's no similar .t for return values 19:36
gfldex codesections: this is a case of „Cannot do non-typename cases of type_constraint yet“ indeed 19:45
gfldex codesections: you might be asking for a rabbit hole. One might return a callable that returns a callable. What do you do if it's callables all the way down? :-> 20:18
jdv insert a turtle 20:23
jdv yawns 20:23
codesections m: my $world = "\c[TURTLE]" xx ∞; say $world[42] 20:28
camelia 🐢
codesections gfldex: more seriously, that doesn't seem like any more of a problem than other places where recursion could be infinite. Many of Raku's functional idioms seem to have been inspired by Haskell, and Haskell certainly supports (indeed, requires) specifying the type of a returned function 20:30
e.g. (in Haskell): curry :: ((a,b)->c) -> a->b->c 20:31
in (psudo) Raku: sub curry(&fn:(\a, \b --> Code) --> &(--> &(--> Code))) {...} 20:33
gfldex In Heskell the return type is part of dispatch, so you acutally need to nail returned functions down. Without proper macros creating functions and therefor signatures on the fly requires EVIL. So with the new macro system we might need checks in the returned subs signature. 20:34
codesections interesting. I don't really know Haskell, so I'm not 100% sure I followed. Are you saying that the Haskell version of the following (impossible-in-Raku) code would work? 20:37
m: multi f(--> Int) { 1 }; multi f(--> Str) { "one" }; my Str $a = f(); 20:38
camelia Ambiguous call to 'f(...)'; these signatures all match:
()
()
in block <unit> at <tmp> line 1
gfldex you got it
codesections So we could potentially get ^^^ that to work one day, post RakuAST? 20:39
gfldex No, Raku is to dynamic for that. 20:40
gfldex Also, there is Nil (and Failure). 20:41
Well, we might get custom dispatchers. So with a slang it might be possible. 20:46
moritz you have to be careful with that; dispatch happens based on the actual types at runtime, not just the declared types 20:50
you cannot do that with return dispatch, because you don't know the actual type in advance
I don't know how confusing it will be if the two dispatch criteria are subtly different though; maybe it's not as much of a problem as I imagine it to be 20:51
codesections even in current Raku, though, you can do something like: 20:53
m: multi f(--> Int) { 1 }; multi f(--> Str) { "one" }; my Str $a = &f.candidates.first({.of ~~ Str})()
camelia ( no output )
codesections m: multi f(--> Int) { 1 }; multi f(--> Str) { "one" }; my Str $a = &f.candidates.first({.of ~~ Str})(); dd $a
camelia Str $a = "one"
gfldex And there is your custom dispatch. 20:54
m: multi f(--> Int) { 1 }; multi f(--> Str) { fail("one") }; my Str $a = &f.candidates.first({.of ~~ Str})(); dd $a
camelia Earlier failure:
one
in sub f at <tmp> line 1
in block <unit> at <tmp> line 1

Final error:
Type check failed in assignment to $a; expected Str but got Failure (Failure.new(exceptio...)
in block <unit> at <tmp> line 1
Geth doc/mu-perl: 7082554e2f | (Stoned Elipot)++ | doc/Type/Mu.pod6
Add Mu.perl back

  ... which may have been removed by mistake.
Make its documentation somewhat minimal.
21:07
doc/mu-perl: ac4e630c84 | (Stoned Elipot)++ | doc/Type/Mu.pod6
Use code formatting and link to routine documentation
doc: stoned++ created pull request #3900:
Add back Mu.perl and tweak Mu.raku
21:08
holly_ I've just uploaded my first sound program, Soundn::Tina (needs to be debugged) 22:59