Skip to content

Instantly share code, notes, and snippets.

@grondilu
Created July 30, 2013 16:34
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/6114580 to your computer and use it in GitHub Desktop.
Save grondilu/6114580 to your computer and use it in GitHub Desktop.
sub ethiop(Complex:D \z, Int:D \n where n > 0) {
my ($p, $z, $n) = 1, z, n;
until $n == 0 {
$p *= $z unless $n %% 2;
$n div= 2;
$z *= $z;
}
return $p;
}
say ethiop(1i, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment