mirror of
https://github.com/samsonjs/sectorlisp.git
synced 2026-03-25 09:05:48 +00:00
Make JS improvements
This commit is contained in:
parent
6b5fbf22f0
commit
8ad3d4822f
1 changed files with 7 additions and 2 deletions
9
lisp.js
9
lisp.js
|
|
@ -43,7 +43,7 @@ function Car(x) {
|
|||
if (x < 0) {
|
||||
return Get(x);
|
||||
} else {
|
||||
Throw(x);
|
||||
Throw(List(kCar, x));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ function Cdr(x) {
|
|||
if (x < 0) {
|
||||
return Get(x + 1);
|
||||
} else {
|
||||
Throw(x);
|
||||
Throw(List(kCdr, x));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -144,6 +144,10 @@ function Remove(x, y) {
|
|||
return Cons(Car(y), Remove(x, Cdr(y)));
|
||||
}
|
||||
|
||||
function List(x, y) {
|
||||
return Cons(x, Cons(y, 0));
|
||||
}
|
||||
|
||||
function Define(x, y) {
|
||||
return Cons(Cons(x, Read()), Remove(x, y));
|
||||
}
|
||||
|
|
@ -166,6 +170,7 @@ function Evlis(m, a) {
|
|||
}
|
||||
|
||||
function Pairlis(x, y, a) {
|
||||
if (!!x ^ !!y) Throw(List(x, y));
|
||||
return x ? Cons(Cons(Car(x), Car(y)),
|
||||
Pairlis(Cdr(x), Cdr(y), a)) : a;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue