mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-01-07 00:29:34 +00:00
Inline parts of eval_expr()
This commit is contained in:
parent
6a67577a9b
commit
e4a5b1a5a5
@ -8,7 +8,7 @@
|
||||
(lambda (l fn)
|
||||
(cond
|
||||
((null l) nil)
|
||||
(T (cons (fn l) (maplist (cdr l) fn)))
|
||||
(t (cons (fn l) (maplist (cdr l) fn)))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -519,19 +519,25 @@ end
|
||||
export def eval_expr(expr)#1
|
||||
if expr
|
||||
if expr->type == CONS_TYPE
|
||||
//
|
||||
// List - first element better be a function
|
||||
//
|
||||
if expr=>car->type & TYPE_MASK == SYM_TYPE
|
||||
if expr=>car=>natv
|
||||
if expr=>car=>natv // Native function
|
||||
return expr=>car=>natv(expr=>cdr)
|
||||
elsif expr=>car=>lambda
|
||||
elsif expr=>car=>lambda // DEFINEd lambda S-expression
|
||||
return eval_lambda(expr=>car=>lambda, expr=>cdr)
|
||||
else
|
||||
else // Symbol associated with lambda
|
||||
return eval_lambda(assoc(expr=>car)=>cdr, expr=>cdr)
|
||||
fin
|
||||
elsif expr=>car->type == CONS_TYPE and expr=>car=>car == sym_lambda
|
||||
return eval_lambda(expr=>car, expr=>cdr)
|
||||
fin
|
||||
else
|
||||
return eval_atom(expr)
|
||||
//
|
||||
// Atom
|
||||
//
|
||||
return expr->type & TYPE_MASK == SYM_TYPE ?? assoc(expr)=>cdr :: expr
|
||||
fin
|
||||
fin
|
||||
return NULL
|
||||
|
Loading…
Reference in New Issue
Block a user