Mercurial > lasercutter
view src/clojure/lang/Cons.java @ 10:ef7dbbd6452c
added clojure source goodness
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 21 Aug 2010 06:25:44 -0400 |
parents | |
children |
line wrap: on
line source
1 /**2 * Copyright (c) Rich Hickey. All rights reserved.3 * The use and distribution terms for this software are covered by the4 * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)5 * which can be found in the file epl-v10.html at the root of this distribution.6 * By using this software in any fashion, you are agreeing to be bound by7 * the terms of this license.8 * You must not remove this notice, or any other, from this software.9 **/11 /* rich Mar 25, 2006 11:01:29 AM */13 package clojure.lang;15 import java.io.Serializable;17 final public class Cons extends ASeq implements Serializable {19 private final Object _first;20 private final ISeq _more;22 public Cons(Object first, ISeq _more){23 this._first = first;24 this._more = _more;25 }28 public Cons(IPersistentMap meta, Object _first, ISeq _more){29 super(meta);30 this._first = _first;31 this._more = _more;32 }34 public Object first(){35 return _first;36 }38 public ISeq next(){39 return more().seq();40 }42 public ISeq more(){43 if(_more == null)44 return PersistentList.EMPTY;45 return _more;46 }48 public int count(){49 return 1 + RT.count(_more);50 }52 public Cons withMeta(IPersistentMap meta){53 return new Cons(meta, _first, _more);54 }55 }