wl

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

commit 204feba4ab5e7c78f5b67c490ba25930cdee9759
parent 705745a59e9e838193c1c0a35feb97b6f121d0f1
Author: tomas <tomas@logand.com>
Date:   Sun, 11 Oct 2009 14:51:58 +0200

let? jnum heap impl

Diffstat:
Mjava.wl | 22+++++++++++++++++-----
Mwl.java | 13+++++++++++++
2 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/java.wl b/java.wl @@ -150,11 +150,11 @@ (and (not Y) T) (and Y T) ) ) -(de let? L - (let (K (pop 'L) V (eval (pop 'L) 1)) - (when V - (def 'K V) - (run L 1 '(K)) ) ) ) # TODO +# (de let? L +# (let (K (pop 'L) V (eval (pop 'L) 1)) +# (when V +# (def 'K V) +# (run L 1 '(K)) ) ) ) # TODO (de println @ (pass print) @@ -211,3 +211,15 @@ (setq Z (Z 'reminder Y)) ) ) ) (de + @ (- (pass - 0))) + +(de jnum (X) + (jnew `(jclass 'java.math.BigInteger) (X ' toString)) ) + +(de heap @ + (let R `((jclass 'java.lang.Runtime) 'getRuntime) + (/ (if (args) + (if (=T (next)) + (jnum (R 'freeMemory)) + (jnum (R 'maxMemory)) ) + (- (jnum (R 'totalMemory)) (jnum (R 'freeMemory))) ) + `(* 1024 1024) ) ) ) diff --git a/wl.java b/wl.java @@ -712,6 +712,19 @@ class wl implements Runnable { } else err(E, "Don't know how to let"); return Z; }}); + fn("let?", new Fn() {public Any fn(Any E) { + Any Z = NIL; + Any I = E.cdr(); + Any L = I.car(); + I = I.cdr(); + Any V = eval(I.car()); + if(NIL != V) { + bind(L, V); + Z = xrun(I.cdr()); + unbind(); + } + return Z; + }}); fn("use", new Fn() {public Any fn(Any E) { Any Z = NIL; Any I = E.cdr();