protected static ISeq ontoArrayPrepend(Object[] array, Object... args){ ISeq ret = ArraySeq.create(array); for(int i = args.length - 1; i >= 0; --i) ret = RT.cons(args[i], ret); return ret; }
private boolean step() { if(next != NONE) return true; while (next == NONE) { if(buffer.isEmpty()) { if(completed) { return false; } else if (sourceIter.hasNext()) { Object iter = null; if(multi) iter = xf.applyTo(RT.cons(null, sourceIter.next())); else iter = xf.invoke(null, sourceIter.next()); if(RT.isReduced(iter)) { xf.invoke(null); completed = true; } } else { xf.invoke(null); completed = true; } } else { next = buffer.remove(); } } return true; }
Object newval = action.fn.applyTo(RT.cons(action.agent.state, action.args)); action.agent.setState(newval); action.agent.notifyWatches(oldval,newval);
static public ISeq arrayToList(Object[] a) { ISeq ret = null; for(int i = a.length - 1; i >= 0; --i) ret = (ISeq) cons(a[i], ret); return ret; }
static ISeq fwdPath(PathNode p1){ ISeq ret = null; for(;p1 != null;p1 = p1.parent) ret = RT.cons(p1,ret); return ret; }
static ISeq push(Node t, ISeq stack, boolean asc){ while(t != null) { stack = RT.cons(t, stack); t = asc ? t.left() : t.right(); } return stack; }
static public ISeq listStar(Object arg1, ISeq rest){ return (ISeq) cons(arg1, rest); }
static void closeOver(LocalBinding b, ObjMethod method){ if(b != null && method != null) { if(RT.get(method.locals, b) == null) { method.objx.closes = (IPersistentMap) RT.assoc(method.objx.closes, b, b); closeOver(b, method.parent); } else if(IN_CATCH_FINALLY.deref() != null) { method.localsUsedInCatchFinally = (PersistentHashSet) method.localsUsedInCatchFinally.cons(b.idx); } } }
protected static ISeq ontoArrayPrepend(Object[] array, Object... args){ ISeq ret = ArraySeq.create(array); for(int i = args.length - 1; i >= 0; --i) ret = RT.cons(args[i], ret); return ret; }
public ISeq cons(Object o){ return RT.cons(o, seq()); }
static ISeq push(Node t, ISeq stack, boolean asc){ while(t != null) { stack = RT.cons(t, stack); t = asc ? t.left() : t.right(); } return stack; }
public Object alter(IFn fn, ISeq args) { set(fn.applyTo(RT.cons(deref(), args))); return this; }
public Object alter(IFn fn, ISeq args) { set(fn.applyTo(RT.cons(deref(), args))); return this; }
synchronized public Object alterRoot(IFn fn, ISeq args) { Object newRoot = fn.applyTo(RT.cons(root, args)); validate(getValidator(), newRoot); Object oldroot = root; this.root = newRoot; ++rev; notifyWatches(oldroot,newRoot); return newRoot; }
public Object alter(IFn fn, ISeq args) { LockingTransaction t = LockingTransaction.getEx(); return t.doSet(this, fn.applyTo(RT.cons(t.doGet(this), args))); }
public Object alter(IFn fn, ISeq args) { LockingTransaction t = LockingTransaction.getEx(); return t.doSet(this, fn.applyTo(RT.cons(t.doGet(this), args))); }