Exemple #1
0
 public final synchronized 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;
 }
Exemple #2
0
  public IPersistentCollection cons(Object o) {
    if (o instanceof Map.Entry) {
      Map.Entry e = (Map.Entry) o;

      return assoc(e.getKey(), e.getValue());
    } else if (o instanceof IPersistentVector) {
      IPersistentVector v = (IPersistentVector) o;
      if (v.count() != 2)
        throw new IllegalArgumentException("Vector arg to map conj must be a pair");
      return assoc(v.nth(0), v.nth(1));
    }

    IPersistentMap ret = this;
    for (ISeq es = RT.seq(o); es != null; es = es.next()) {
      Map.Entry e = (Map.Entry) es.first();
      ret = ret.assoc(e.getKey(), e.getValue());
    }
    return ret;
  }
Exemple #3
0
 public boolean equals(Object o) {
   ISeq s = seq();
   if (s != null) return s.equiv(o);
   else return (o instanceof Sequential || o instanceof List) && RT.seq(o) == null;
 }