1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-08-08 09:25:19 +00:00

Fix NUMBERP

This commit is contained in:
David Schmenk
2024-07-22 19:14:14 -07:00
parent ec3b9de737
commit 0fd3afdd7a
3 changed files with 6 additions and 6 deletions

Binary file not shown.

View File

@@ -1014,6 +1014,11 @@ def natv_eq(symptr, expr)
return bool_pred(iseq) return bool_pred(iseq)
end end
def natv_numberp(symptr, expr)
expr = eval_expr(expr=>car)
return bool_pred(expr and (expr->type & TYPE_MASK == NUM_TYPE))
end
def natv_and(symptr, expr) def natv_and(symptr, expr)
while expr and eval_expr(expr=>car) while expr and eval_expr(expr=>car)
expr = expr=>cdr expr = expr=>cdr
@@ -1355,6 +1360,7 @@ new_sym("CONS")=>natv = @natv_cons
new_sym("LIST")=>natv = @natv_list new_sym("LIST")=>natv = @natv_list
new_sym("ATOM")=>natv = @natv_atom new_sym("ATOM")=>natv = @natv_atom
new_sym("EQ")=>natv = @natv_eq new_sym("EQ")=>natv = @natv_eq
new_sym("NUMBERP")=>natv = @natv_numberp
new_sym("NOT")=>natv = @natv_null new_sym("NOT")=>natv = @natv_null
new_sym("AND")=>natv = @natv_and new_sym("AND")=>natv = @natv_and
new_sym("OR")=>natv = @natv_or new_sym("OR")=>natv = @natv_or

View File

@@ -118,11 +118,6 @@ def push_num(numptr)#0
fin fin
end end
def natv_numberp(symptr, expr)
expr = eval_expr(expr)
return bool_pred(expr and (expr->type & TYPE_MASK == NUM_TYPE))
end
def natv_sum(symptr, expr) def natv_sum(symptr, expr)
var num var num
var[2] intsum var[2] intsum
@@ -788,7 +783,6 @@ fpu:constE()
fpu:pullExt(@tempext) fpu:pullExt(@tempext)
new_sym("MATH_E")=>apval = new_float(@tempext) ^ NULL_HACK new_sym("MATH_E")=>apval = new_float(@tempext) ^ NULL_HACK
fpu:sinX() // Force load of ELEMS library fpu:sinX() // Force load of ELEMS library
new_sym("NUMBERP")=>natv = @natv_numberp
new_sym("SUM")=>natv = @natv_sum new_sym("SUM")=>natv = @natv_sum
new_sym("+")=>natv = @natv_sum new_sym("+")=>natv = @natv_sum
new_sym("-")=>natv = @natv_sub new_sym("-")=>natv = @natv_sub