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.
habere-et-disper Is -Ofun in the docs somewhere (I couldn't find it). I understand the meaning to come from compiler optimization. Who coined it? 13:39
lucs I think Audrey Tang came up with that, possibly around the time when the Haskell implementation of the language began (2004 or something). 13:42
Audrey had two genius ideas, unheard of at the time as far as I can tell, when for that Haskell project: 13:45
First: you want to commit to the Git repo? No problem, we'll let you.Anyone could get a commit bit, no questions asked. 13:46
Second: you're not much of a coder? No problem, write tests to match the specification to the best of your understanding. 13:47
habere-et-disper Thanks lucs_ ! The more you know. :-) 13:49
lucs You're welcome, and keep having -Ofun 🙂
deoac How do I create a signature for `sub foo` which will be called by both `foo test` and `foo Test` 17:31
lizmat create a subtype, and use that in the signature 17:32
that's currently the only way that I know of
unless you meant "test" and "Test" as strings ?
deoac Yes, I meant them as Strings 17:34
lizmat m: sub a($a where *.lc eq 'test') { dd }; a 'test'; a 'TEST' 17:37
camelia sub a($a where { ... })
sub a($a where { ... })
deoac But your subset idea works great!  Thank you.
lizmat m: sub a($a where *.lc eq 'test' | 'Test') { dd }; a 'test'; a 'TEST'
camelia sub a($a where { ... })
sub a($a where { ... })
lizmat m: sub a($a where * eq 'test' | 'Test') { dd }; a 'test'; a 'TEST' 17:38
camelia sub a($a where { ... })
Constraint type check failed in binding to parameter '$a'; expected anonymous constraint to be met but got Str ("TEST")
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
deoac m: subset Test of Str where * ~~ /:i ^ test $/; sub a(Test) {dd}; a 'test'; a 'TEST' 17:41
camelia sub a(Test)
sub a(Test)
lizmat deoac: that's effectively the same as where *.lc eq 'test' 17:43
but if you find your version easier to read, by all means :-)
deoac Ah, very nice 17:44
gfldex m: subset Ttest where 'test'|'Test'; sub foo(Ttest --> True) {}; say foo(<test Test>.all); 22:35
camelia all(True, True)