diff --git a/src/lisp/drawl.pla b/src/lisp/drawl.pla index 7c1a0f1..732b227 100644 --- a/src/lisp/drawl.pla +++ b/src/lisp/drawl.pla @@ -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 diff --git a/src/lisp/maplist.lisp b/src/lisp/maplist.lisp new file mode 100644 index 0000000..149df07 --- /dev/null +++ b/src/lisp/maplist.lisp @@ -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))) + ) + ) + ) +) diff --git a/src/lisp/set.lisp b/src/lisp/set.lisp index 43f70ec..9f4b865 100644 --- a/src/lisp/set.lisp +++ b/src/lisp/set.lisp @@ -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) diff --git a/src/mklisp b/src/mklisp index 89c7156..96549bc 100755 --- a/src/mklisp +++ b/src/mklisp @@ -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 diff --git a/src/mkrel b/src/mkrel index e4e6e44..6e876e7 100755 --- a/src/mkrel +++ b/src/mkrel @@ -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