Skip to content

Instantly share code, notes, and snippets.

@paniq
Created September 15, 2016 22:30
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 paniq/fad74734f4f987c1d5c69378b5f44268 to your computer and use it in GitHub Desktop.
Save paniq/fad74734f4f987c1d5c69378b5f44268 to your computer and use it in GitHub Desktop.
>unbuffer liminal "cff.n"
source:
(quote
(function fac ((n number))
(function fac-times
((n number)
(acc number))
(if (== n 0) acc
(fac-times (- n 1)
(* acc n))))
(fac-times n 1)
))
control flow form:
c(x : bool):
branch(x, then, else)
else():
p7(n2)
fac(n : number, ret : any):
p12(1)
fac-times(n2 : number, acc : number, ret2 : any):
p9(0)
p(x2 : any):
x2(x3, x4, ret2)
p10(x11 : any):
x11(x12, x13, ret)
p11(x12 : any):
p10(fac-times)
p12(x13 : any):
p11(n)
p2(x3 : any):
p(fac-times)
p3(x5 : any):
p2((x5 - x6))
p4(x6 : any):
p3(n2)
p5(x4 : any):
p4(1)
p6(x7 : any):
p5((x7 * x8))
p7(x8 : any):
p6(acc)
p8(x9 : any):
c((x9 == x10))
p9(x10 : any):
p8(n2)
then():
ret2(acc)
execution:
fac(5, function: 0x40718838)
p12(1)
p11(n)
p10(fac-times)
x11(x12, x13, ret)
p9(0)
p8(n2)
c((x9 == x10))
branch(x, then, else)
else()
p7(n2)
p6(acc)
p5((x7 * x8))
p4(1)
p3(n2)
p2((x5 - x6))
p(fac-times)
x2(x3, x4, ret2)
p9(0)
p8(n2)
c((x9 == x10))
branch(x, then, else)
else()
p7(n2)
p6(acc)
p5((x7 * x8))
p4(1)
p3(n2)
p2((x5 - x6))
p(fac-times)
x2(x3, x4, ret2)
p9(0)
p8(n2)
c((x9 == x10))
branch(x, then, else)
else()
p7(n2)
p6(acc)
p5((x7 * x8))
p4(1)
p3(n2)
p2((x5 - x6))
p(fac-times)
x2(x3, x4, ret2)
p9(0)
p8(n2)
c((x9 == x10))
branch(x, then, else)
else()
p7(n2)
p6(acc)
p5((x7 * x8))
p4(1)
p3(n2)
p2((x5 - x6))
p(fac-times)
x2(x3, x4, ret2)
p9(0)
p8(n2)
c((x9 == x10))
branch(x, then, else)
else()
p7(n2)
p6(acc)
p5((x7 * x8))
p4(1)
p3(n2)
p2((x5 - x6))
p(fac-times)
x2(x3, x4, ret2)
p9(0)
p8(n2)
c((x9 == x10))
branch(x, then, else)
then()
ret2(acc)
result: 120
>Exit code: 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment