本文整理汇总了Java中clojure.lang.ISeq.first方法的典型用法代码示例。如果您正苦于以下问题:Java ISeq.first方法的具体用法?Java ISeq.first怎么用?Java ISeq.first使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clojure.lang.ISeq
的用法示例。
在下文中一共展示了ISeq.first方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: map
import clojure.lang.ISeq; //导入方法依赖的package包/类
public void map(Object key, Object value, Collector<Object, Object> collector){
if(fn == null) {
IFn require = Clojure.var("clojure.core", "require");
require.invoke(Clojure.read(ns));
fn = Clojure.var(ns, sym);
}
for (Object o : (Iterable)fn.invoke(key, value)){
Seqable s = (Seqable)o;
ISeq seq = s.seq();
Object k = seq.first();
Object v = seq.next().first();
collector.emit(k, v);
}
}
示例2: invoke
import clojure.lang.ISeq; //导入方法依赖的package包/类
@Override
public Object invoke(Object newVal) {
if (newVal instanceof Seqable) {
ISeq seq = ((Seqable) newVal).seq();
// An empty seqable returns null.
if (seq == null) {
return true;
}
int count = seq.count();
while (count --> 0) {
Object o = seq.first();
seq = seq.next();
if (!(o instanceof Runnable)) {
return false;
}
}
return true;
}
else if (newVal == null) {
return true;
}
else {
return false;
}
}
示例3: get
import clojure.lang.ISeq; //导入方法依赖的package包/类
@Override
public IValue get(int i) throws IndexOutOfBoundsException {
if (i < 0 || i >= length()) throw new IndexOutOfBoundsException();
// return (IValue) core$nth.invoke(xs, i);
ISeq rest = xs;
for (; i > 0; rest = rest.next(), i--);
return (IValue) rest.first();
}
示例4: lub
import clojure.lang.ISeq; //导入方法依赖的package包/类
private static Type lub(ISeq xs, Type base) {
Type result = base;
while (xs != null && xs.first() != null) {
result = result.lub(((IValue) xs.first()).getType());
xs = xs.next();
}
return result;
}
示例5: deleteFromSeq
import clojure.lang.ISeq; //导入方法依赖的package包/类
protected static ISeq deleteFromSeq(ISeq xs, IValue x) {
int i = 0;
ISeq ys = xs;
while (ys != null && ys.first() != null) {
if (ys.first().equals(x)) {
return core$concat(core$take(i, xs), ys.next());
}
i = i + 1;
ys = ys.next();
}
return xs;
}
示例6: get
import clojure.lang.ISeq; //导入方法依赖的package包/类
private Object get(ISeq current, int index) {
if (index <= 0) {
return current.first();
} else {
return get(current.next(), index=1);
}
}
示例7: SignalFolder
import clojure.lang.ISeq; //导入方法依赖的package包/类
public SignalFolder(Seqable funs) {
ISeq seq = funs.seq();
// seq may be null
if (seq == null) {
fns = new Runnable[0];
}
else {
fns = new Runnable[seq.count()];
for (int i = 0; i < fns.length; i++) {
fns[i] = (Runnable) seq.first();
seq = seq.next();
}
}
originalList = funs;
}