The VM now supports the various int comparison methods. An example of a "pow" method is given to show off recursion, which means we're now TURING COMPLETE! Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
16 lines
201 B
Plaintext
16 lines
201 B
Plaintext
pow = fn (n, p) {
|
|
if p <= 0 {
|
|
return 1
|
|
} el {
|
|
return n * pow(n, p - 1)
|
|
}
|
|
}
|
|
|
|
kilo = pow(2, 10)
|
|
mega = pow(2, 20)
|
|
giga = pow(2, 30)
|
|
|
|
println(kilo)
|
|
println(mega)
|
|
println(giga)
|