Beginning work on infix operators in mexprs.

This commit is contained in:
Simon Brooke 2023-03-25 16:25:56 +00:00
parent 434276ecea
commit ce7fe8f3ef
No known key found for this signature in database
GPG key ID: A7A4F18D1D4DF987
6 changed files with 152 additions and 29 deletions

View file

@ -18,5 +18,4 @@ apply[fn;args;a] = [
cons[cons[cadr[fn];caddr[fn]]; a]];
eq[car[fn]; FUNARG] -> apply[cadr[fn]; args; caddr[fn]];
eq[car[fn]; LAMBDA] -> eval[caddr[fn]; nconc[pair[cadr[fn]; args]; a]];
T -> apply[eval[fn;a]; args; a]]
T -> apply[eval[fn;a]; args; a]]

3
resources/ff.mexpr.lsp Normal file
View file

@ -0,0 +1,3 @@
;; From page 6 of Lisp 1.5 Programmer's Manual
ff[x]=[atom[x] -> x; T -> ff[car[x]]]

3
resources/gcd.mexpr.lsp Normal file
View file

@ -0,0 +1,3 @@
gcd[x;y] = [x>y -> gcd[y;x];
rem[y;x] = 0 -> x;
T -> gcd[rem[y;x];x]]