RosettaCodeData/Task/Exponentiation-operator/Brat/exponentiation-operator.brat
2023-07-01 13:44:08 -04: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