Re: Design question re: function parameters

2017-03-07 Thread Timo Paulssen
On 07/03/17 17:59, Sean McAfee wrote: > […] If I want to freely accept both numbers and strings in the manner > of > Perl 5, it looks like I must type all of my function arguments as > Cool, or omit the types altogether. […] Don't forget you can use a coercive type in parameter lists: sub

Design question re: function parameters

2017-03-07 Thread Sean McAfee
Recently this Perl 6 version of the factorial function was mentioned: sub postfix:(Int $n) { [*] 2 .. $n } I experimented a bit with it and found that I couldn't do '3'! as I naively expected from my Perl 5 intuition. Similarly, I can't pass an integer literal to a function that takes a