wl

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

commit 784ec09a55ec28a69b5f88e809b451d2b0c62804
parent ca99dd99deb84fdb5175d5460ba0fdc431534612
Author: tomas <tomas@logand.com>
Date:   Mon, 26 Oct 2009 23:18:54 +0100

job + inc dec implemented

Diffstat:
Mjava.wl | 10++++++++++
Mwl.java | 26++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/java.wl b/java.wl @@ -459,3 +459,13 @@ (de abs (N) (if (lt0 N) (- N) N)) (de test (X . P) (println X (run P 1))) + +(de inc (X . @) + (if (num? X) + (1+ X) + (set X (+ (val X) (or (next) 1))) ) ) + +(de dec (X . @) + (if (num? X) + (1- X) + (set X (- (val X) (or (next) 1))) ) ) diff --git a/wl.java b/wl.java @@ -947,6 +947,32 @@ class wl implements Runnable { } else err(E, "Don't know how to let"); return Z; }}); + fn("job", new Fn() {public Any fn(Any E) { + Any Z = NIL; + Any I = E.cdr(); + Any J = eval(I.car()); + if(J.isCons()) { + int n = 0; + Any L = J; + while(L.isCons()) { + Any C = L.car(); + L = L.cdr(); + bind(C.car(), C.cdr()); + n++; + } + try {Z = xrun(I.cdr());} + finally { + L = J; + while(L.isCons()) { + Any C = L.car(); + L = L.cdr(); + C.cdr(C.car().val()); + } + unbind(n); + } + } else err(E, "Don't know how to job"); + return Z; + }}); fn("up", new Fn() {public Any fn(Any E) { // (up [cnt] sym ['val]) Any Z; Any I = E.cdr();