wl

Unnamed repository; edit this file 'description' to name the repository.
git clone https://logand.com/git/wl.git/
Log | Files | Refs | LICENSE

commit 009e450ec50263f7d3ecbe3d5af81fe0aacc2f3d
parent 0927fd391a7bb06fa67a2aeb977ddd0cf0175ad6
Author: tomas <tomas@logand.com>
Date:   Wed,  7 Oct 2009 23:55:59 +0200

pop and con implemented in java

Diffstat:
Mwl.java | 22++++++++++++++++++++++
1 file changed, 22 insertions(+), 0 deletions(-)

diff --git a/wl.java b/wl.java @@ -609,6 +609,28 @@ class wl implements Runnable { fn("intern", new Fn() {public Any fn(Any E) { return intern((String) eval(E.cdr().car()).cxr()); }}); + fn("pop", new Fn() {public Any fn(Any E) { + Any Z = NIL; + Any X = eval(E.cdr().car()); + if(X.isCons()) { + Any V = X.car(); + Z = V.car(); + X.car(V.cdr()); + } else if(X.isSym()) { + Any V = X.val(); + Z = V.car(); + X.val(V.cdr()); + } else err(E, "Don't know how to pop"); + return Z; + }}); + fn("con", new Fn() {public Any fn(Any E) { + Any I = E.cdr(); + Any L = eval(I.car()); + I = I.cdr(); + Any Z = eval(I.car()); + L.cdr(Z); + return Z; + }}); fn("jnew", new Fn() {public Any fn(Any E) { // jnew 'cls [arg ...] Any I = E.cdr();