mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-01-09 13:33:26 +00:00
fix evaluations in CONS, CAR, and CDR
This commit is contained in:
parent
45cf817bd1
commit
d481bfaad1
@ -544,23 +544,21 @@ def natv_cons(expr)
|
||||
var consptr
|
||||
|
||||
consptr = new_cons
|
||||
consptr=>car = expr=>car
|
||||
consptr=>cdr = expr=>cdr=>car
|
||||
consptr=>car = eval_expr(expr=>car)
|
||||
consptr=>cdr = eval_expr(expr=>cdr=>car)
|
||||
return consptr
|
||||
end
|
||||
|
||||
def natv_car(expr)
|
||||
if expr->TYPE == CONS_TYPE
|
||||
return expr=>car
|
||||
fin
|
||||
return NULL
|
||||
return eval_expr(expr=>car)=>car
|
||||
end
|
||||
|
||||
def natv_cdr(expr)
|
||||
if expr->TYPE == CONS_TYPE
|
||||
return expr=>cdr
|
||||
fin
|
||||
return NULL
|
||||
return eval_expr(expr=>car)=>cdr
|
||||
end
|
||||
|
||||
def natv_quote(expr)
|
||||
return expr=>car
|
||||
end
|
||||
|
||||
def natv_cond(expr)
|
||||
@ -695,7 +693,7 @@ def install_defaults#0
|
||||
new_assoc(new_sym("NIL"), @pred_false)
|
||||
sym_lambda = new_sym("LAMBDA")
|
||||
sym_quote = new_sym("QUOTE")
|
||||
sym_quote=>natv = @natv_car)
|
||||
sym_quote=>natv = @natv_quote)
|
||||
new_sym("CAR")=>natv = @natv_car)
|
||||
new_sym("CDR")=>natv = @natv_cdr)
|
||||
new_sym("CONS")=>natv = @natv_cons)
|
||||
|
Loading…
x
Reference in New Issue
Block a user