Created
January 20, 2014 16:13
-
-
Save grondilu/8523064 to your computer and use it in GitHub Desktop.
FRACTRAN in Perl 6. See http://rosettacode.org/wiki/Fractran
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 fractran(@r) { | |
sub ($n) { | |
first Int, map (* *$n).narrow, @r | |
} | |
} | |
say .[^20] given | |
2, fractran(< | |
17/91 78/85 19/51 23/38 29/33 77/29 95/23 77/19 1/17 11/13 13/11 15/14 15/2 55/1 | |
>) ... *; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment