public ISeq chunkedNext() { return chunkedMore().seq(); }
public Expr parse(C context, Object frm) { int line = (Integer) LINE.deref(); int column = (Integer) COLUMN.deref(); ISeq form = (ISeq) frm; //(new Classname args...) if(form.count() < 2) throw Util.runtimeException("wrong number of arguments, expecting: (new Classname args...)"); Class c = HostExpr.maybeClass(RT.second(form), false); if(c == null) throw new IllegalArgumentException("Unable to resolve classname: " + RT.second(form)); PersistentVector args = PersistentVector.EMPTY; for(ISeq s = RT.next(RT.next(form)); s != null; s = s.next()) args = args.cons(analyze(context == C.EVAL ? context : C.EXPRESSION, s.first())); return new NewExpr(c, args, line, column); } }
private ISeq current() { if(_current == null) { ISeq current = prev.next(); _current = (current == null) ? all : current; } return _current; }
public Object first(){ return current().first(); }
public Expr parse(C context, Object frm) { ISeq form = (ISeq) frm; if(form.count() > 4) throw Util.runtimeException("Too many arguments to if"); else if(form.count() < 3) throw Util.runtimeException("Too few arguments to if"); PathNode branch = new PathNode(PATHTYPE.BRANCH, (PathNode) CLEAR_PATH.get());
public boolean equiv(Object o){ ISeq s = seq(); if(s != null) return s.equiv(o); else return (o instanceof Sequential || o instanceof List) && RT.seq(o) == null; }
public Expr parse(C context, Object frm) { int line = lineDeref(); int column = columnDeref(); ISeq form = (ISeq) frm; //(new Classname args...) if(form.count() < 2) throw Util.runtimeException("wrong number of arguments, expecting: (new Classname args...)"); Class c = HostExpr.maybeClass(RT.second(form), false); if(c == null) throw new IllegalArgumentException("Unable to resolve classname: " + RT.second(form)); PersistentVector args = PersistentVector.EMPTY; for(ISeq s = RT.next(RT.next(form)); s != null; s = s.next()) args = args.cons(analyze(context == C.EVAL ? context : C.EXPRESSION, s.first())); return new NewExpr(c, args, line, column); } }
private ISeq current() { if(_current == null) { ISeq current = prev.next(); _current = (current == null) ? all : current; } return _current; }
public int hasheq(){ if(_hasheq == -1){ int hash = 0; for(ISeq s = seq(); s != null; s = s.next()) { Object e = s.first(); hash += Util.hasheq(e); } this._hasheq = hash; } return _hasheq; }
public ISeq more(){ seq(); if(s == null) return PersistentList.EMPTY; return s.more(); }
private static Expression analyseSeq(Environment env, ISeq form) { int n=form.count(); if (n==0) return Constant.create(form); Object first=form.first(); Object expandedForm=macroFn.applyTo(RT.cons(form,RT.cons(PersistentHashMap.EMPTY, form.next()))); return analyse(env,expandedForm); Expression[] params=new Expression[paramCount]; int i=0; for (ISeq s=RT.seq(paramSeq); s!=null; s=s.next()) { params[i++]=analyse(env,s.first());
static public int boundedLength(ISeq list, int limit) { int i = 0; for(ISeq c = list; c != null && i <= limit; c = c.next()) { i++; } return i; }
static int countFrom(Object o){ if(o == null) return 0; else if(o instanceof IPersistentCollection) { ISeq s = seq(o); o = null; int i = 0; for(; s != null; s = s.next()) { if(s instanceof Counted) return i + s.count(); i++; } return i; } else if(o instanceof CharSequence) return ((CharSequence) o).length(); else if(o instanceof Collection) return ((Collection) o).size(); else if(o instanceof Map) return ((Map) o).size(); else if (o instanceof Map.Entry) return 2; else if(o.getClass().isArray()) return Array.getLength(o); else if(Protocol.satisfiesICount(o)) return ((Integer)Protocol.bridgeICountedCount(o)).intValue(); throw new UnsupportedOperationException("count not supported on this type: " + o.getClass().getSimpleName()); }
public Object first() { if(s != null) return s.first(); return new MapEntry(array[i], array[i+1]); }
public ISeq chunkedNext(){ return chunkedMore().seq(); }