algebrite
Version:
Computer Algebra System in Coffeescript
53 lines (38 loc) • 650 B
text/coffeescript
Eval_product = ->
i = 0
j = 0
k = 0
p6 = cadr(p1)
if (!issymbol(p6))
stop("product: 1st arg?")
push(caddr(p1))
Eval()
j = pop_integer()
if (j == 0x80000000)
stop("product: 2nd arg?")
push(cadddr(p1))
Eval()
k = pop_integer()
if (k == 0x80000000)
stop("product: 3rd arg?")
p1 = caddddr(p1)
p4 = get_binding(p6)
p3 = get_arglist(p6)
push_integer(1)
for i in [j..k]
push_integer(i)
p5 = pop()
set_binding(p6, p5)
push(p1)
Eval()
multiply()
set_binding_and_arglist(p6, p4, p3)