wl

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

commit d618401a5a9f8fd6b8076ffce7c6e2ecf6d4a95e
parent f86dfaaa3be1cbaa747b10fe5430212211a720ad
Author: tomas <tomas@logand.com>
Date:   Fri, 23 Apr 2010 23:54:33 +0200

s/Isym/Nsym/

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

diff --git a/wl.java b/wl.java @@ -90,7 +90,7 @@ class wl implements Runnable { public Object obj(Object x); public boolean isCons(); public boolean isSym(); - public boolean isIsym(); + public boolean isNsym(); public boolean isAsym(); public boolean isObj(); public boolean isOfn(); @@ -114,7 +114,7 @@ class wl implements Runnable { public Object obj(Object x) {err("No Cons.obj"); return null;} public boolean isCons() {return true;}; public boolean isSym() {return false;}; - public boolean isIsym() {return false;}; + public boolean isNsym() {return false;}; public boolean isAsym() {return false;}; public boolean isObj() {return false;}; public boolean isOfn() {return false;}; @@ -123,24 +123,24 @@ class wl implements Runnable { public boolean isOobj() {return false;}; } static interface Sym extends Any {} - static class Isym implements Sym { + static class Nsym implements Sym { public String nm; public Any val, prop; - public Isym(String n, Any v, Any p) {nm = n; val = v; prop = p;} + public Nsym(String n, Any v, Any p) {nm = n; val = v; prop = p;} public String nm() {return nm;} - public Any car() {if(NIL != this) err("No Isym.car"); return NIL;} - public Any cdr() {if(NIL != this) err("No Isym.cdr"); return NIL;} + public Any car() {if(NIL != this) err("No Nsym.car"); return NIL;} + public Any cdr() {if(NIL != this) err("No Nsym.cdr"); return NIL;} public Any val() {return val;} public Any prop() {return prop;} - public Object obj() {err("No Isym.obj"); return null;} - public Any car(Any a) {err("No Isym.car"); return null;} - public Any cdr(Any d) {err("No Isym.cdr"); return null;} + public Object obj() {err("No Nsym.obj"); return null;} + public Any car(Any a) {err("No Nsym.car"); return null;} + public Any cdr(Any d) {err("No Nsym.cdr"); return null;} public Any val(Any v) {val = v; return val;} public Any prop(Any p) {prop = p; return prop;} - public Object obj(Object x) {err("No Isym.obj"); return null;} + public Object obj(Object x) {err("No Nsym.obj"); return null;} public boolean isCons() {return false;}; public boolean isSym() {return true;}; - public boolean isIsym() {return true;}; + public boolean isNsym() {return true;}; public boolean isAsym() {return false;}; public boolean isObj() {return false;}; public boolean isOfn() {return false;}; @@ -164,7 +164,7 @@ class wl implements Runnable { public Object obj(Object x) {err("No Asym.obj"); return null;} public boolean isCons() {return false;}; public boolean isSym() {return true;}; - public boolean isIsym() {return false;}; + public boolean isNsym() {return false;}; public boolean isAsym() {return true;}; public boolean isObj() {return false;}; public boolean isOfn() {return false;}; @@ -188,7 +188,7 @@ class wl implements Runnable { public Object obj(Object x) {obj = x; return obj;} public boolean isCons() {return false;}; public boolean isSym() {return false;}; - public boolean isIsym() {return false;}; + public boolean isNsym() {return false;}; public boolean isAsym() {return false;}; public boolean isObj() {return true;}; public boolean isOfn() {return obj instanceof Fn;}; @@ -198,7 +198,7 @@ class wl implements Runnable { } static Any mkCons(Any a, Any d) {return new Cons(a, d);} - static Any mkIsym(String n, Any v) {return new Isym(n, v, NIL);} + static Any mkNsym(String n, Any v) {return new Nsym(n, v, NIL);} static Any mkAsym(Any v, Any p) {return new Asym(v, p);} static Any mkObj(Object x) {return new Obj(x);} static Any mkOint(String x) {return mkObj(new BigInteger(x));} @@ -216,8 +216,8 @@ class wl implements Runnable { return mkObj(m); } - final static Any NIL = mkIsym("NIL", null); - final static Any T = mkIsym("T", null); + final static Any NIL = mkNsym("NIL", null); + final static Any T = mkNsym("T", null); static { NIL.val(NIL); @@ -228,10 +228,10 @@ class wl implements Runnable { final static Any Lp = mkObj(null); final static Any Rp = mkObj(null); - final Any Qte = mkIsym("quote", NIL); - final Any Dot = mkIsym(".", NIL); - final Any At = mkIsym("@", NIL); - final Any Args = mkIsym("*Args", NIL); + final Any Qte = mkNsym("quote", NIL); + final Any Dot = mkNsym(".", NIL); + final Any At = mkNsym("@", NIL); + final Any Args = mkNsym("*Args", NIL); public static class In { InputStream s; @@ -266,11 +266,11 @@ class wl implements Runnable { } } - final Any In = mkIsym("*In", mkObj(new In(System.in))); - final Any Out = mkIsym("*Out", mkObj(System.out)); - final Any Env = mkIsym("*Env", NIL); - final Any Stk = mkIsym("*Stk", NIL); - final Any Scl = mkIsym("*Scl", mkObj(BigInteger.ZERO)); + final Any In = mkNsym("*In", mkObj(new In(System.in))); + final Any Out = mkNsym("*Out", mkObj(System.out)); + final Any Env = mkNsym("*Env", NIL); + final Any Stk = mkNsym("*Stk", NIL); + final Any Scl = mkNsym("*Scl", mkObj(BigInteger.ZERO)); Character peek() {return ((In) In.val().obj()).peek();} Character xchar() {return ((In) In.val().obj()).xchar();} @@ -378,7 +378,7 @@ class wl implements Runnable { HashMap<String, Any> Sd = new HashMap<String, Any>(); Any intern(String Nm) { - if(!Sd.containsKey(Nm)) Sd.put(Nm, mkIsym(Nm, NIL)); + if(!Sd.containsKey(Nm)) Sd.put(Nm, mkNsym(Nm, NIL)); return Sd.get(Nm); } @@ -401,7 +401,7 @@ class wl implements Runnable { Any E = undo(n, L); try { if(X.isCons()) Z = apply(X); - else if(X.isIsym()) Z = X.val(); + else if(X.isNsym()) Z = X.val(); else if(X.isObj()) Z = X; else err(X, "Don't know how to eval"); } finally {redo(E);} @@ -425,7 +425,7 @@ class wl implements Runnable { Any Fa = F.car(); Any Fb = F.cdr(); Any B = NIL; - if(Fa.isIsym()) { // (@ . P) | (L . P) | (NIL . P) + if(Fa.isNsym()) { // (@ . P) | (L . P) | (NIL . P) if(NIL != Fa) { if(At == Fa) B = mkCons(mkCons(Args, mkCons(NIL, mapcarEval(A))), B); else B = mkCons(mkCons(Fa, A), B); @@ -502,10 +502,10 @@ class wl implements Runnable { if(boolean.class == c || Boolean.class == c) return true; if(char.class == c || Character.class == c) { if(A.isOstr()) return 1 == ((String) A.obj()).length(); - else return A.isIsym() && 1 == A.nm().length(); + else return A.isNsym() && 1 == A.nm().length(); } if(NIL == A && String.class == c) return true; - return c.isInstance(A.isIsym() ? A.nm() : A.obj()); + return c.isInstance(A.isNsym() ? A.nm() : A.obj()); } boolean isApplicable(Method m, Any[] a) { Class[] c = m.getParameterTypes(); @@ -577,7 +577,7 @@ class wl implements Runnable { if(char.class == c || Character.class == c) return (A.isOstr() ? (String) A.obj() : A.nm()).charAt(0); if(NIL == A && String.class == c) return ""; - if(A.isIsym()) return A.nm(); + if(A.isNsym()) return A.nm(); return A.obj(); } Object[] methodArgs(Method m, Any[] a) { @@ -633,7 +633,7 @@ class wl implements Runnable { void fn(String Nm, Fn F) { Any Z = Sd.get(Nm); if(null != Z) Z.val(mkObj(F)); - else Sd.put(Nm, mkIsym(Nm, mkObj(F))); + else Sd.put(Nm, mkNsym(Nm, mkObj(F))); } boolean member(Any X, Any L) { for(; L.isCons(); L = L.cdr()) @@ -736,7 +736,7 @@ class wl implements Runnable { Sd.put("*Env", Env); Sd.put("*Stk", Stk); Sd.put("*Scl", Scl); - Sd.put("java.lang.Class", mkIsym("java.lang.Class", mkObj(Class.class))); + Sd.put("java.lang.Class", mkNsym("java.lang.Class", mkObj(Class.class))); fn("run", new Fn() {public Any fn(Any E) { Any I = E.cdr(); @@ -994,7 +994,7 @@ class wl implements Runnable { } try {Z = xrun(I.cdr());} finally {unbind(n);} - } else if(L.isIsym()) { // (let L 'V . P) + } else if(L.isNsym()) { // (let L 'V . P) I = I.cdr(); Any V = eval(I.car()); bind(L, V); @@ -1029,7 +1029,7 @@ class wl implements Runnable { } try {Z = xrun(I.cdr());} finally {unbind(n);} - } else if(L.isIsym()) { // (use L . P) + } else if(L.isNsym()) { // (use L . P) bind(L); try {Z = xrun(I.cdr());} finally {unbind();} @@ -1078,7 +1078,7 @@ class wl implements Runnable { } try {Z = xrun(I.cdr());} finally {unbind(n);} - } else if(L.isIsym()) { // (bind L . P) + } else if(L.isNsym()) { // (bind L . P) bind(L); try {Z = xrun(I.cdr());} finally {unbind();} @@ -1280,7 +1280,7 @@ class wl implements Runnable { }}); fn("chop", new Fn() {public Any fn(Any E) { Any V = eval(E.cdr().car()); - String v = V.isIsym() ? V.nm() : V.obj().toString(); + String v = V.isNsym() ? V.nm() : V.obj().toString(); Any Z = NIL; for(int i = v.length() - 1; 0 <= i; i--) Z = mkCons(mkObj("" + v.charAt(i)), Z); @@ -1378,7 +1378,7 @@ class wl implements Runnable { } S.print(')'); } - } else if(E.isIsym()) S.print(E.nm()); + } else if(E.isNsym()) S.print(E.nm()); else if(E.isAsym()) { String n = E.toString(); S.print("$" + n.substring(1 + n.lastIndexOf("@"))); @@ -1409,7 +1409,7 @@ class wl implements Runnable { X = X.cdr(); } prin(X); - } else if(E.isIsym()) S.print(E.nm()); + } else if(E.isNsym()) S.print(E.nm()); else if(E.isAsym()) { String n = E.toString(); S.print("$" + n.substring(1 + n.lastIndexOf("@")));