8 ms·
Yup both right. All the clues were there >:3 I could have used Inf instead of the unicode but thats not really whimsical enough for Hacker News. A slightly les
by Ultimatt 8y ago
Yup both right. All the clues were there >:3 I could have used Inf instead of the unicode but thats not really whimsical enough for Hacker News.
A slightly less listy pattern style is to declare types. Like I'd prefer this sort of declarative style:
subset Prime of Int where *.is-prime;
subset TwinPrime of Prime where (* + (2|-2)).is-prime;
my @twin_primes = grep TwinPrime, ^Inf;
Just feels a lot more clear what my intent is and I get some cheap types for later, to use in function parameters that require twin primes.
- nerdponx 8y agoHuh, this is actually making me want to give Perl 6 another try. How is performance on a task like this compared to, say, Python?