@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TaggedLiteral that = (TaggedLiteral) o; if (form != null ? !form.equals(that.form) : that.form != null) return false; if (tag != null ? !tag.equals(that.tag) : that.tag != null) return false; return true; }
public static Namespace remove(Symbol name){ if(name.equals(RT.CLOJURE_NS.name)) throw new IllegalArgumentException("Cannot remove clojure namespace"); return namespaces.remove(name); }
public static Namespace remove(Symbol name){ if(name.equals(RT.CLOJURE_NS.name)) throw new IllegalArgumentException("Cannot remove clojure namespace"); return namespaces.remove(name); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TaggedLiteral that = (TaggedLiteral) o; if (form != null ? !form.equals(that.form) : that.form != null) return false; if (tag != null ? !tag.equals(that.tag) : that.tag != null) return false; return true; }
public int compareTo(Object o){ Symbol s = (Symbol) o; if(this.equals(o)) return 0; if(this.ns == null && s.ns != null) return -1; if(this.ns != null) { if(s.ns == null) return 1; int nsc = this.ns.compareTo(s.ns); if(nsc != 0) return nsc; } return this.name.compareTo(s.name); }
public int compareTo(Object o){ Symbol s = (Symbol) o; if(this.equals(o)) return 0; if(this.ns == null && s.ns != null) return -1; if(this.ns != null) { if(s.ns == null) return 1; int nsc = this.ns.compareTo(s.ns); if(nsc != 0) return nsc; } return this.name.compareTo(s.name); }
private static Type analyseTypeSymbol(Symbol sym) { if (sym.equals(Symbols.ANY)) return Types.ANYTHING; if (sym.equals(Symbols.NOTHING)) return Types.NOTHING; if (sym.equals(Symbols.NIL)) return Types.NULL; if (sym.equals(Symbols.TYPE)) return Types.TYPE; if (sym.equals(Symbols.SYMBOL_TYPE)) return Types.SYMBOL; if (sym.equals(Symbols.KEYWORD_TYPE)) return Types.KEYWORD; if (sym.getNamespace()==null) { String name=sym.getName(); if (!name.contains(".")) name="java.lang."+name; Class<?> c=RT.classForName(name); if (c!=null) return JavaType.create(c); } throw new KissException("Unrecognised type symbol: "+sym); }
public static Expression analyseSymbol(Environment env,Symbol sym) { if (sym.equals(Symbols.NIL)) return Constant.NULL; if (sym.equals(Symbols.TRUE)) return Constant.TRUE; if (sym.equals(Symbols.FALSE)) return Constant.FALSE; if (sym.getNamespace()!=null) return ClojureLookup.create(sym); return Lookup.create(sym); }
private static Type analyseTypeSeq(ISeq s) { List<Object> al=KissUtils.asList(s); Symbol sym=(Symbol) al.get(0); if (sym.equals(Symbols.U)) { Type[] types=analyseSequenceOfTypes(al,1,al.size()-1); return Union.create(types); } else if (sym.equals(Symbols.I)) { Type[] types=analyseSequenceOfTypes(al,1,al.size()-1); return Intersection.create(types); } throw new KissException("Unrecognised type form: "+s); }
static public Object maybeResolveIn(Namespace n, Symbol sym) { //note - ns-qualified vars must already exist if(sym.ns != null) { Namespace ns = namespaceFor(n, sym); if(ns == null) return null; Var v = ns.findInternedVar(Symbol.intern(sym.name)); if(v == null) return null; return v; } else if(sym.name.indexOf('.') > 0 && !sym.name.endsWith(".") || sym.name.charAt(0) == '[') { return RT.classForName(sym.name); } else if(sym.equals(NS)) return RT.NS_VAR; else if(sym.equals(IN_NS)) return RT.IN_NS_VAR; else { Object o = n.getMapping(sym); return o; } }
if(fs.equals(THE_VAR))
if (s.equals(Symbols.LET)) { IPersistentVector v=KissUtils.expectVector(RT.second(form)); int vc=v.count(); if (s.equals(Symbols.LOOP)) { IPersistentVector v=KissUtils.expectVector(RT.second(form)); int vc=v.count(); if (s.equals(Symbols.RECUR)) { int vc=n-1; Expression[] values=new Expression[vc]; if (s.equals(Symbols.RETURN)) { Expression value=analyse(env,RT.nth(form,1)); return Return.create(value); if (s.equals(Symbols.IF)) { switch (n) { case 4: if (s.equals(Symbols.INSTANCE)) { switch (n) { case 3: if (s.equals(Symbols.DEF)) { if (n!=3) throw new KissException("Wrong number of forms in def expression: "+n); Symbol sym=(Symbol)RT.nth(form,1); if (s.equals(Symbols.DO)) {