wl

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

commit 54e917d744815a33311f7253e66b1acdcd6da1ad
parent c3cff89897bb2d5b6bf277f905a7b33a70aef31e
Author: tomas <tomas@logand.com>
Date:   Sun,  1 Nov 2009 15:22:27 +0100

jfield fully implemented, & | x| >>

Diffstat:
Mjava.wl | 9+++++++++
Mwl.java | 15++++++++-------
2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/java.wl b/java.wl @@ -279,6 +279,15 @@ (0 'subtract (car A)) ) ) ) ) (de + @ (when (args) (- (pass - 0)))) +(de & @ (when (args) (foldl1 '((X Y) (X 'and Y)) (rest)))) +(de | @ (when (args) (foldl1 '((X Y) (X 'or Y)) (rest)))) +(de x| @ (when (args) (foldl1 '((X Y) (X 'xor Y)) (rest)))) + +(de >> (N X) + (if (gt0 N) + (X 'shiftRight N) + (X 'shiftLeft (abs N)) ) ) + (de max @ (foldl1 '((X Y) (if (> X Y) X Y)) (rest))) # TODO > (de min @ (foldl1 '((X Y) (if (< X Y) X Y)) (rest))) # TODO < diff --git a/wl.java b/wl.java @@ -1143,18 +1143,19 @@ class wl implements Runnable { return Z; }}); fn("jfield", new Fn() {public Any fn(Any E) { // jfield 'obj 'fld ['val] - // TODO set 'val - Any X = E.cdr(); - Any O = eval(X.car()); - X = X.cdr(); - Any F = eval(X.car()); + Any I = E.cdr(); + Any O = eval(I.car()); + I = I.cdr(); + Any F = eval(I.car()); Any Z = NIL; try { Object o = O.obj(); Class c = o instanceof Class ? (Class) o : o.getClass(); Field f = c.getField(F.nm()); - Object r = f.get(o); - Z = mkObj(r); + if(NIL != I.cdr()) { + Z = eval(I.cdr().car()); + f.set(o, jarg(f.getType(), Z)); + } else Z = mkObj(f.get(o)); } catch(NoSuchFieldException e) { err(E, "NoSuchFieldException"); } catch(IllegalAccessException e) {