Last active
August 29, 2015 14:03
-
-
Save grondilu/f64589d8110917751695 to your computer and use it in GitHub Desktop.
ludic numbers with lazy splicing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub lazy-splice(@list, @splice) { | |
gather { take @list[$_] for @splice } | |
} | |
constant ludic = 1, gather { | |
my @candidates := 2 .. *; | |
loop { | |
take my $ludic = @candidates[0]; | |
@candidates := lazy-splice( | |
@candidates, | |
grep * % $ludic, 1 .. * | |
); | |
} | |
} | |
say ludic[^25]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment