git @ Cat's Eye Technologies Exanoke / rel_1_0_2015_0101 eg / factorial.exanoke
rel_1_0_2015_0101

Tree @rel_1_0_2015_0101 (Download .tar.gz)

factorial.exanoke @rel_1_0_2015_0101raw · history · blame

def inc(#)
  cons(:one, #)
def add(#, other)
  if eq?(#, :nil) then other else self(<tail #, inc(other))
def mul(#, other)
  if eq?(#, :nil) then :nil else
    add(other, self(<tail #, other))
def fact(#)
  if eq?(#, :nil) then cons(:one, :nil) else
    mul(#, self(<tail #))
def four(#)
  cons(:one, cons(:one, cons(:one, cons(:one, #))))

fact(four(:nil))