Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@grondilu
Created January 20, 2014 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grondilu/8523064 to your computer and use it in GitHub Desktop.
Save grondilu/8523064 to your computer and use it in GitHub Desktop.
FRACTRAN in Perl 6. See http://rosettacode.org/wiki/Fractran
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