Package clojure.lang

Examples of clojure.lang.ISeq.first()


            if (v instanceof Seqable) {
                ISeq seq = ((Seqable) v).seq();
                while (seq != null) {
                    bytes.append(k);
                    bytes.append(COLON, SP);
                    bytes.append(seq.first().toString(), HttpUtils.UTF_8);
                    bytes.append(CR, LF);
                    seq = seq.next();
                }
            } else {
                bytes.append(k);
View Full Code Here


            return readAll((File) body);
        } else if (body instanceof Seqable) {
            ISeq seq = ((Seqable) body).seq();
            DynamicBytes b = new DynamicBytes(seq.count() * 512);
            while (seq != null) {
                b.append(seq.first().toString(), UTF_8);
                seq = seq.next();
            }
            return ByteBuffer.wrap(b.get(), 0, b.length());
            // makes ultimate optimization possible: no copy
        } else if (body instanceof ByteBuffer) {
View Full Code Here

  @Override
  public Type intersection(Type t) {
    PersistentHashSet values=this.values;
    ISeq s=values.seq();
    while(s!=null) {
      Object o=s.first();
      if (!t.checkInstance(o)) {
        values=(PersistentHashSet) values.disjoin(o);
      }
      s=s.next();
    }
View Full Code Here

                super(rows, columns);
                this.meta = null;
                ISeq seq = coll.seq();
                for(int i = 0; i < (rows); i++) {
                        for(int j = 0; j < (columns); j++) {
                                this.set(i, j, ((Number)(seq.first())).doubleValue());
                                seq = seq.next();
                        }
                }
        }
View Full Code Here

                                for(int j = 0; j < (this.columns); j++)
                                        newData[i][j] = this.getQuick(i, j);
                        ISeq restObj = v;
                        int cols = 0;
                        while(cols < this.columns) {
                                newData[this.rows][cols] = ((Number)(restObj.first())).doubleValue();
                                restObj = restObj.next();
                                cols++;
                        }

                        return(new Matrix(newData));
View Full Code Here

     * nrepl response to come back !
     */
    private boolean hasEvalResponseException(Object evalResponse) {
      ISeq responseSeq = (ISeq) evalResponse;
      while (responseSeq != null) {
        Map<?,?> m = (Map<?,?>) responseSeq.first();
        if (m.containsKey(errorResponseKey)) {
          return true;
        }
        responseSeq = responseSeq.next();
      }
View Full Code Here

        public void itemsCanBeAddedIntoSequence() {
            ISeq seq = context.newInstance();
            ISeq value = context.addValue(seq, 1);
            ISeq value2 = context.addValue(value, 2);
            specify(value2.count(), does.equal(2));
            specify(value2.first(), does.equal(2));
            specify(value2.next().first(), does.equal(1));
        }
    }

}
View Full Code Here

    if ((item instanceof ISeq) || (item instanceof Seqable) || (item instanceof Iterable)) {
      ISeq seq = RT.seq(item);
      long chain = preChain;
      long first = 0;
      while (seq != null) {
        Object o = seq.first();
        if (o != null) {
          long rc  = buildResponseItemBuf(r, o, chain);
          if (rc <= 0) {
            if (rc != -NGX_HTTP_NO_CONTENT) {
              return rc;
View Full Code Here

      return;
    }
   
   
    for (int i = 0; i < c; i++) {
      String val = (String) seq.first();
      seq = seq.next();
      if (val != null) {
        long p = NginxClojureRT.ngx_list_push(h + NGX_HTTP_CLOJURE_HEADERSO_HEADERS_OFFSET);
        if (p == 0) {
          throw new RuntimeException("can not push ngx list for headers");
View Full Code Here

    if (lp == 0) {
      throw new RuntimeException("can not push ngx array for header");
    }
   
    for (int i = 0; i < c; i++) {
      String val = (String) seq.first();
      seq = seq.next();
      if (val != null) {
        long p = NginxClojureRT.ngx_list_push(h + NGX_HTTP_CLOJURE_HEADERSO_HEADERS_OFFSET);
        if (p == 0) {
          throw new RuntimeException("can not push ngx list for headers");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.