
Untitled
By: a guest on
Jun 22nd, 2012 | syntax:
None | size: 0.79 KB | hits: 9 | expires: Never
Performance of Clojure lazy structures vs hashes/sets/vectors?
public Object first(){
return _first;
}
public Object first(){
seq();
if(s == null)
return null;
return s.first();
}
final synchronized Object sval(){
if(fn != null)
{
try
{
sv = fn.invoke();
fn = null;
}
catch(Exception e)
{
throw new RuntimeException(e);
}
}
if(sv != null)
return sv;
return s;
}
final synchronized public ISeq seq(){
sval();
if(sv != null)
{
Object ls = sv;
sv = null;
while(ls instanceof LazySeq)
{
ls = ((LazySeq)ls).sval();
}
s = RT.seq(ls);
}
return s;
}