algebrite
Version:
Computer Algebra System in Coffeescript
88 lines (59 loc) • 1.68 kB
text/coffeescript
internal, treenode, general concept
General description
-------------------
Completely wipes all variables from the environment.
Eval_clearall = ->
do_clearall()
push(symbol(NIL))
do_clearall = ->
if (test_flag == 0)
clear_term()
do_clearPatterns()
clear_symbols()
defn()
codeGen = false
clearall = ->
run("clearall")
clearRenamedVariablesToAvoidBindingToExternalScope = ->
for i in [0...symtab.length]
if symtab[i].printname.indexOf("AVOID_BINDING_TO_EXTERNAL_SCOPE_VALUE") != -1
symtab[i].k = SYM
symtab[i].printname = ""
binding[i] = symtab[i]
isSymbolReclaimable[i] = true
Tags
----
scripting, JS, internal, treenode, general concept
Parameters
----------
x
General description
-------------------
Completely wipes a variable from the environment (while doing x = quote(x) just unassigns it).
###
Eval_clear = ->
p2 = cdr(p1)
while (iscons(p2))
variableToBeCleared = car(p2)
if (variableToBeCleared.k != SYM)
stop("symbol error")
indexFound = symtab.indexOf(variableToBeCleared)
symtab[indexFound].k = SYM
symtab[indexFound].printname = ""
binding[indexFound] = symtab[indexFound]
isSymbolReclaimable[indexFound] = true
p2 = cdr(p2)
push(symbol(NIL))
Tags
----
scripting, JS,