RosettaCodeData/Task/Exponentiation-operator/Brat/exponentiation-operator.brat
Ingy döt Net 764da6cbbb CDE
2013-04-10 16:57:12 -07:00

13 lines
220 B
Text

#Procedure
exp = { base, exp |
1.to(exp).reduce 1, { m, n | m = m * base }
}
#Numbers are weird
1.parent.^ = { rhs |
num = my
1.to(rhs).reduce 1 { m, n | m = m * num }
}
p exp 2 5 #Prints 32
p 2 ^ 5 #Prints 32