1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-07 00:29:34 +00:00

Fix ATOM and add EQUAL to SET functions(

This commit is contained in:
David Schmenk 2024-07-08 09:00:13 -07:00
parent 5e3baa70fb
commit c5e56c7d63
5 changed files with 39 additions and 9 deletions

View File

@ -544,8 +544,18 @@ def eval_pred(bool)
return bool ?? @pred_true :: @pred_false
end
def natv_atom(atom)
return eval_pred(!atom or atom->type <> CONS_TYPE)
def natv_atom(expr)
var result
result = eval_expr(expr=>car)
return eval_pred(!result or result->type <> CONS_TYPE))
end
def natv_null(expr)
var result
result = eval_expr(expr=>car)
return eval_pred(!result or !result->type)
end
def natv_eq(expr)
@ -601,13 +611,6 @@ def natv_cond(expr)
return NULL
end
def natv_null(expr)
var result
result = eval_expr(expr=>car)
return eval_pred(!result or !result->type)
end
def natv_label(expr)
var valptr

15
src/lisp/maplist.lisp Normal file
View File

@ -0,0 +1,15 @@
(define
(ydot
(lambda (x y)
(maplist x '(lambda (j) (cons (car j) y)))
)
)
(maplist
(lambda (l fn)
(cond
((null l) nil)
(T (cons (fn l) (maplist (cdr l) fn)))
)
)
)
)

View File

@ -1,4 +1,14 @@
(define
(equal (lambda (x y)
(cond ((atom x) (cond ((atom y) (eq x y))
( t f)
)
)
((equal (car x) (car y)) (equal (cdr x) (cdr y)))
( t f)
))
)
(member (lambda (a x)
(cond ((null x) f)
((eq a (car x)) t)

View File

@ -3,3 +3,4 @@ cp ../sysfiles/BLANK140.po PLASMA-2.1-LISP.po
cat rel/DRAWL#FE1000 | ./ac.jar -p PLASMA-2.1-LISP.po DRAWL REL
cat lisp/drawl.pla | ./ac.jar -ptx PLASMA-2.1-LISP.po DRAWL.PLA TXT
cat lisp/set.lisp | ./ac.jar -ptx PLASMA-2.1-LISP.po SET.LISP TXT
cat lisp/maplist.lisp | ./ac.jar -ptx PLASMA-2.1-LISP.po MAPLIST.LISP TXT

View File

@ -177,6 +177,7 @@ mkdir prodos/bld/lisp
cp rel/DRAWL#FE1000 prodos/bld/lisp/DRAWL.REL
cp lisp/drawl.pla prodos/bld/lisp/DRAWL.PLA.TXT
cp lisp/set.lisp prodos/bld/lisp/SET.LISP.TXT
cp lisp/maplist.lisp prodos/bld/lisp/MAPLIST.LISP.TXT
#mkdir prodos/bld/examples
#cp samplesrc/examples/ex.1.pla prodos/bld/examples/EX.1.PLA.TXT