summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cli/runtime/AFn.cs103
-rw-r--r--src/cli/runtime/AMap.cs40
-rw-r--r--src/cli/runtime/BigNum.cs225
-rw-r--r--src/cli/runtime/Box.cs28
-rw-r--r--src/cli/runtime/Cons.cs32
-rw-r--r--src/cli/runtime/DoubleNum.cs242
-rw-r--r--src/cli/runtime/FixNum.cs243
-rw-r--r--src/cli/runtime/FloatNum.cs21
-rw-r--r--src/cli/runtime/IFn.cs37
-rw-r--r--src/cli/runtime/IntegerNum.cs21
-rw-r--r--src/cli/runtime/Keyword.cs49
-rw-r--r--src/cli/runtime/Namespace.cs83
-rw-r--r--src/cli/runtime/Num.cs252
-rw-r--r--src/cli/runtime/RT.cs212
-rw-r--r--src/cli/runtime/RatioNum.cs229
-rw-r--r--src/cli/runtime/RationalNum.cs21
-rw-r--r--src/cli/runtime/RealNum.cs21
-rw-r--r--src/cli/runtime/RestFn0.cs65
-rw-r--r--src/cli/runtime/RestFn1.cs63
-rw-r--r--src/cli/runtime/RestFn2.cs59
-rw-r--r--src/cli/runtime/RestFn3.cs56
-rw-r--r--src/cli/runtime/RestFn4.cs53
-rw-r--r--src/cli/runtime/RestFn5.cs49
-rw-r--r--src/cli/runtime/Symbol.cs96
-rw-r--r--src/cli/runtime/ThreadLocalData.cs86
25 files changed, 2386 insertions, 0 deletions
diff --git a/src/cli/runtime/AFn.cs b/src/cli/runtime/AFn.cs
new file mode 100644
index 00000000..9b1cb05b
--- /dev/null
+++ b/src/cli/runtime/AFn.cs
@@ -0,0 +1,103 @@
+/**
+ * Copyright (c) Rich Hickey. All rights reserved.
+ * The use and distribution terms for this software are covered by the
+ * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
+ * which can be found in the file CPL.TXT at the root of this distribution.
+ * By using this software in any fashion, you are agreeing to be bound by
+ * the terms of this license.
+ * You must not remove this notice, or any other, from this software.
+ **/
+
+/* rich Mar 25, 2006 4:05:37 PM */
+
+using System;
+
+namespace org.clojure.runtime
+{
+
+public class AFn : AMap , IFn
+ {
+
+virtual public Object invoke(ThreadLocalData tld) /*throws Exception*/
+ {
+ return throwArity();
+ }
+
+virtual public Object invoke(ThreadLocalData tld, Object arg1) /*throws Exception*/
+ {
+ return throwArity();
+ }
+
+virtual public Object invoke(ThreadLocalData tld, Object arg1, Object arg2) /*throws Exception*/
+ {
+ return throwArity();
+ }
+
+virtual public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3) /*throws Exception*/
+ {
+ return throwArity();
+ }
+
+virtual public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4) /*throws Exception*/
+ {
+ return throwArity();
+ }
+
+virtual public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5)
+ /*throws Exception*/
+ {
+ return throwArity();
+ }
+
+virtual public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Cons args)
+ /*throws Exception*/
+ {
+ return throwArity();
+ }
+
+virtual public Object applyTo(ThreadLocalData tld, Cons arglist) /*throws Exception*/
+ {
+ switch(RT.boundedLength(arglist, 5))
+ {
+ case 0:
+ return invoke(tld);
+ case 1:
+ return invoke(tld, arglist.first);
+ case 2:
+ return invoke(tld, arglist.first
+ , (arglist = arglist.rest).first
+ );
+ case 3:
+ return invoke(tld, arglist.first
+ , (arglist = arglist.rest).first
+ , (arglist = arglist.rest).first
+ );
+ case 4:
+ return invoke(tld, arglist.first
+ , (arglist = arglist.rest).first
+ , (arglist = arglist.rest).first
+ , (arglist = arglist.rest).first
+ );
+ case 5:
+ return invoke(tld, arglist.first
+ , (arglist = arglist.rest).first
+ , (arglist = arglist.rest).first
+ , (arglist = arglist.rest).first
+ , (arglist = arglist.rest).first
+ );
+ default:
+ return invoke(tld, arglist.first
+ , (arglist = arglist.rest).first
+ , (arglist = arglist.rest).first
+ , (arglist = arglist.rest).first
+ , (arglist = arglist.rest).first
+ , arglist.rest);
+ }
+ }
+
+protected Object throwArity()
+ {
+ throw new Exception("Wrong number of args passed");
+ }
+}
+} \ No newline at end of file
diff --git a/src/cli/runtime/AMap.cs b/src/cli/runtime/AMap.cs
new file mode 100644
index 00000000..76850122
--- /dev/null
+++ b/src/cli/runtime/AMap.cs
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) Rich Hickey. All rights reserved.
+ * The use and distribution terms for this software are covered by the
+ * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
+ * which can be found in the file CPL.TXT at the root of this distribution.
+ * By using this software in any fashion, you are agreeing to be bound by
+ * the terms of this license.
+ * You must not remove this notice, or any other, from this software.
+ **/
+
+/* rich Mar 25, 2006 3:44:58 PM */
+
+using System;
+using System.Collections.Specialized;
+
+namespace org.clojure.runtime
+{
+
+public class AMap
+{
+
+HybridDictionary attrs;
+public static int INITIAL_SIZE = 7;
+
+public Object put(Symbol key, Object val)
+ {
+ if(attrs == null)
+ attrs = new HybridDictionary(INITIAL_SIZE);
+ attrs[key] = val;
+ return val;
+ }
+
+public Object get(Symbol key)
+ {
+ if(attrs == null)
+ return null;
+ return attrs[key];
+ }
+}
+} \ No newline at end of file
diff --git a/src/cli/runtime/BigNum.cs b/src/cli/runtime/BigNum.cs
new file mode 100644
index 00000000..629f09de
--- /dev/null
+++ b/src/cli/runtime/BigNum.cs
@@ -0,0 +1,225 @@
+/**
+ * Copyright (c) Rich Hickey. All rights reserved.
+ * The use and distribution terms for this software are covered by the
+ * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
+ * which can be found in the file CPL.TXT at the root of this distribution.
+ * By using this software in any fashion, you are agreeing to be bound by
+ * the terms of this license.
+ * You must not remove this notice, or any other, from this software.
+ **/
+
+/* rich Mar 28, 2006 10:08:33 AM */
+
+using System;
+using java.math;
+
+namespace org.clojure.runtime
+{
+
+
+public class BigNum : IntegerNum{
+public BigInteger val;
+
+override public Boolean Equals(Object arg0)
+ {
+ return arg0 != null
+ && arg0 is BigNum
+ && ((BigNum) arg0).val == val;
+ }
+
+override public int GetHashCode()
+ {
+ return val.GetHashCode();
+ }
+
+override public String ToString()
+ {
+ return val.ToString();
+ }
+
+public BigNum(long val)
+ {
+ this.val = BigInteger.valueOf(val);
+ }
+
+public BigNum(BigInteger val)
+ {
+ this.val = val;
+ }
+
+override public double doubleValue()
+ {
+ return val.doubleValue();
+ }
+
+override public float floatValue()
+ {
+ return val.floatValue();
+ }
+
+override public int intValue()
+ {
+ return val.intValue();
+ }
+
+override public long longValue()
+ {
+ return val.longValue();
+ }
+
+override public Boolean equiv(Num rhs)
+ {
+ return rhs.equivTo(val);
+ }
+
+override public Boolean equivTo(BigInteger x)
+ {
+ return x.Equals(val);
+ }
+
+override public Boolean equivTo(int x)
+ {
+ //must be outside of range of int or would be one itself
+ return false;
+ }
+
+override public Boolean equivTo(RatioNum x)
+ {
+ //wouldn't still be a RatioNum if it was an integer
+ return false;
+ }
+
+override public Boolean lt(Num rhs)
+ {
+ return rhs.gt(val);
+ }
+
+override public Boolean gt(BigInteger x)
+ {
+ return x.compareTo(val) < 0;
+ }
+
+override public Boolean gt(int x)
+ {
+ return BigInteger.valueOf(x).compareTo(val) < 0;
+ }
+
+override public Boolean gt(RatioNum x)
+ {
+ return x.numerator.lt(x.denominator.multiply(val));
+ }
+
+override public Num add(Num rhs)
+ {
+ return rhs.addTo(val);
+ }
+
+override public Num addTo(BigInteger x)
+ {
+ return Num.from(x.add(val));
+ }
+
+override public Num addTo(int x)
+ {
+ return Num.from(val.add(BigInteger.valueOf(x)));
+ }
+
+override public Num addTo(RatioNum x)
+ {
+ return x.addTo(val);
+ }
+
+override public Num subtractFrom(Num x)
+ {
+ return x.addTo(val.negate());
+ }
+
+override public Num multiplyBy(Num rhs)
+ {
+ return rhs.multiply(val);
+ }
+
+override public Num multiply(BigInteger x)
+ {
+ return Num.from(x.multiply(val));
+ }
+
+override public Num multiply(int x)
+ {
+ return Num.from(val.multiply(BigInteger.valueOf(x)));
+ }
+
+override public Num multiply(RatioNum x)
+ {
+ return x.multiply(val);
+ }
+
+override public Num divideBy(Num rhs)
+ {
+ return rhs.divide(val);
+ }
+
+override public Num divide(BigInteger n)
+ {
+ return Num.divide(n, val);
+ }
+
+override public Num divide(int n)
+ {
+ return Num.divide(BigInteger.valueOf(n), val);
+ }
+
+override public Num divide(RatioNum x)
+ {
+ return Num.divide(x.numerator, x.denominator.multiply(val));
+ }
+
+override public Object truncateDivide(ThreadLocalData tld, Num num)
+ {
+ return num.truncateBy(tld, val);
+ }
+
+override public Object truncateBy(ThreadLocalData tld, int div)
+ {
+ return Num.truncateBigints(tld, val, BigInteger.valueOf(div));
+ }
+
+override public Object truncateBy(ThreadLocalData tld, BigInteger div)
+ {
+ return Num.truncateBigints(tld, val, div);
+ }
+
+override public Object truncateBy(ThreadLocalData tld, RatioNum div)
+ {
+ Num q = (Num) Num.truncate(tld, div.denominator.multiply(val), div.numerator);
+ return RT.setValues(tld, q, q.multiplyBy(div).subtractFrom(this));
+ }
+
+override public Num negate()
+ {
+ return Num.from(val.negate());
+ }
+
+override public Boolean minusp()
+ {
+ return val.signum() < 0;
+ }
+
+override public Boolean plusp()
+ {
+ return val.signum() > 0;
+ }
+
+
+override public Num oneMinus()
+ {
+ return Num.from(val.subtract(BIG_ONE));
+ }
+
+override public Num onePlus()
+ {
+ return Num.from(val.add(BIG_ONE));
+ }
+}
+}
+
diff --git a/src/cli/runtime/Box.cs b/src/cli/runtime/Box.cs
new file mode 100644
index 00000000..37915bd9
--- /dev/null
+++ b/src/cli/runtime/Box.cs
@@ -0,0 +1,28 @@
+/**
+ * Copyright (c) Rich Hickey. All rights reserved.
+ * The use and distribution terms for this software are covered by the
+ * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
+ * which can be found in the file CPL.TXT at the root of this distribution.
+ * By using this software in any fashion, you are agreeing to be bound by
+ * the terms of this license.
+ * You must not remove this notice, or any other, from this software.
+ **/
+
+/* rich Mar 27, 2006 8:40:19 PM */
+
+using System;
+
+namespace org.clojure.runtime
+{
+
+public class Box
+{
+
+public Object val;
+
+public Box(Object val)
+ {
+ this.val = val;
+ }
+}
+}
diff --git a/src/cli/runtime/Cons.cs b/src/cli/runtime/Cons.cs
new file mode 100644
index 00000000..eec4e475
--- /dev/null
+++ b/src/cli/runtime/Cons.cs
@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) Rich Hickey. All rights reserved.
+ * The use and distribution terms for this software are covered by the
+ * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
+ * which can be found in the file CPL.TXT at the root of this distribution.
+ * By using this software in any fashion, you are agreeing to be bound by
+ * the terms of this license.
+ * You must not remove this notice, or any other, from this software.
+ **/
+
+/* rich Mar 25, 2006 11:01:29 AM */
+
+using System;
+
+namespace org.clojure.runtime
+{
+
+public class Cons : AMap
+ {
+
+public Object first;
+public Cons rest;
+
+public Cons(Object first, Cons rest)
+ {
+ this.first = first;
+ this.rest = rest;
+ }
+
+}
+
+}
diff --git a/src/cli/runtime/DoubleNum.cs b/src/cli/runtime/DoubleNum.cs
new file mode 100644
index 00000000..f3fcc278
--- /dev/null
+++ b/src/cli/runtime/DoubleNum.cs
@@ -0,0 +1,242 @@
+/**
+ * Copyright (c) Rich Hickey. All rights reserved.
+ * The use and distribution terms for this software are covered by the
+ * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
+ * which can be found in the file CPL.TXT at the root of this distribution.
+ * By using this software in any fashion, you are agreeing to be bound by
+ * the terms of this license.
+ * You must not remove this notice, or any other, from this software.
+ **/
+
+/* rich Mar 28, 2006 10:13:45 AM */
+
+using System;
+using java.math;
+
+namespace org.clojure.runtime
+{
+
+public class DoubleNum : FloatNum{
+double val;
+
+public DoubleNum(double val)
+ {
+ this.val = val;
+ }
+
+override public double doubleValue()
+ {
+ return val;
+ }
+
+override public float floatValue()
+ {
+ return (float) val;
+ }
+
+override public int intValue()
+ {
+ return (int) val;
+ }
+
+override public long longValue()
+ {
+ return (long) val;
+ }
+
+
+public Num toRational()
+ {
+ BigDecimal d = new BigDecimal(val);
+ return Num.divide(d.movePointRight(d.scale()).toBigInteger(), BIGTEN.pow(d.scale()));
+ }
+
+override public Boolean equiv(Num rhs)
+ {
+ if(rhs is RatioNum)
+ return equivTo((RatioNum) rhs);
+ return val == rhs.doubleValue();
+ }
+
+override public Boolean equivTo(BigInteger x)
+ {
+ return val == x.doubleValue();
+ }
+
+override public Boolean equivTo(int x)
+ {
+ return x == val;
+ }
+
+override public Boolean equivTo(RatioNum x)
+ {
+ return toRational().equivTo(x);
+ }
+
+override public Boolean lt(Num rhs)
+ {
+ if(rhs is RatioNum)
+ return toRational().lt(rhs);
+ return val < rhs.doubleValue();
+ }
+
+override public Boolean gt(BigInteger x)
+ {
+ return val > x.doubleValue();
+ }
+
+override public Boolean gt(int x)
+ {
+ return val > x;
+ }
+
+override public Boolean gt(RatioNum x)
+ {
+ return toRational().gt(x);
+ }
+
+override public Num add(Num rhs)
+ {
+ return Num.from(val + rhs.doubleValue());
+ }
+
+override public Num addTo(int x)
+ {
+ return Num.from(val + x);
+ }
+
+override public Num addTo(BigInteger x)
+ {
+ return Num.from(val + x.doubleValue());
+ }
+
+override public Num addTo(RatioNum x)
+ {
+ return Num.from(val + x.doubleValue());
+ }
+
+override public Num subtractFrom(Num x)
+ {
+ return Num.from(x.doubleValue() - val);
+ }
+
+override public Num multiplyBy(Num rhs)
+ {
+ return Num.from(val * rhs.doubleValue());
+ }
+
+override public Num multiply(int x)
+ {
+ return Num.from(val * x);
+ }
+
+override public Num multiply(BigInteger x)
+ {
+ return Num.from(val * x.doubleValue());
+ }
+
+override public Num multiply(RatioNum x)
+ {
+ return Num.from(val * x.doubleValue());
+ }
+
+override public Num divideBy(Num rhs)
+ {
+ return Num.from(val / rhs.doubleValue());
+ }
+
+override public Num divide(int x)
+ {
+ return Num.from(x / val);
+ }
+
+override public Num divide(BigInteger x)
+ {
+ return Num.from(x.doubleValue() / val);
+ }
+
+override public Num divide(RatioNum x)
+ {
+ return Num.from(x.doubleValue() / val);
+ }
+
+static Object truncate(ThreadLocalData tld, double n, double d)
+ {
+ double q = n / d;
+ if(q <= Int32.MaxValue && q >= Int32.MinValue)
+ {
+ return RT.setValues(tld, Num.from((int) q),
+ Num.from(n - ((int) q) * d));
+ }
+ else
+ { //bigint quotient
+ Num bq = Num.from(new BigDecimal(q).toBigInteger());
+ return RT.setValues(tld, bq,
+ Num.from(n - bq.doubleValue() * d));
+ }
+ }
+
+override public Object truncateBy(ThreadLocalData tld, BigInteger x)
+ {
+ return truncate(tld, val, x.doubleValue());
+ }
+
+override public Object truncateBy(ThreadLocalData tld, int x)
+ {
+ return truncate(tld, val, x);
+ }
+
+override public Object truncateBy(ThreadLocalData tld, RatioNum x)
+ {
+ return truncate(tld, val, x.doubleValue());
+ }
+
+override public Object truncateDivide(ThreadLocalData tld, Num num)
+ {
+ return truncate(tld, num.doubleValue(), val);
+ }
+
+override public Num negate()
+ {
+ return Num.from(-val);
+ }
+
+override public Boolean Equals(Object arg0)
+ {
+ return arg0 != null
+ && arg0 is DoubleNum
+ &&((DoubleNum) arg0).val.Equals(val);
+ }
+
+override public int GetHashCode()
+ {
+ return val.GetHashCode();
+ }
+
+override public String ToString()
+ {
+ return val.ToString();
+ }
+
+override public Boolean minusp()
+ {
+ return val < 0;
+ }
+
+override public Boolean plusp()
+ {
+ return val > 0;
+ }
+
+override public Num oneMinus()
+ {
+ return Num.from(val - 1);
+ }
+
+override public Num onePlus()
+ {
+ return Num.from(val + 1);
+ }
+
+}
+}
diff --git a/src/cli/runtime/FixNum.cs b/src/cli/runtime/FixNum.cs
new file mode 100644
index 00000000..99750aa7
--- /dev/null
+++ b/src/cli/runtime/FixNum.cs
@@ -0,0 +1,243 @@
+/**
+ * Copyright (c) Rich Hickey. All rights reserved.
+ * The use and distribution terms for this software are covered by the
+ * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
+ * which can be found in the file CPL.TXT at the root of this distribution.
+ * By using this software in any fashion, you are agreeing to be bound by
+ * the terms of this license.
+ * You must not remove this notice, or any other, from this software.
+ **/
+
+/* rich Mar 28, 2006 10:09:27 AM */
+
+using System;
+using java.math;
+
+namespace org.clojure.runtime
+{
+
+
+public class FixNum : IntegerNum{
+public int val;
+
+override public Boolean Equals(Object arg0)
+ {
+ return arg0 != null
+ && arg0 is FixNum
+ && ((FixNum) arg0).val == val;
+ }
+
+override public int GetHashCode()
+ {
+ return val;
+ }
+
+override public String ToString()
+ {
+ return val.ToString();
+ }
+
+public FixNum(int val)
+ {
+ this.val = val;
+ }
+
+override public double doubleValue()
+ {
+ return (double) val;
+ }
+
+override public float floatValue()
+ {
+ return (float) val;
+ }
+
+override public int intValue()
+ {
+ return val;
+ }
+
+override public long longValue()
+ {
+ return (long) val;
+ }
+
+override public Boolean equiv(Num rhs)
+ {
+ return rhs.equivTo(val);
+ }
+
+override public Boolean equivTo(BigInteger x)
+ {
+ //wouldn't still be a BigInteger if it fit in int
+ return false;
+ }
+
+override public Boolean equivTo(int x)
+ {
+ return x == val;
+ }
+
+override public Boolean equivTo(RatioNum x)
+ {
+ //wouldn't still be a RatioNum if it was an integer
+ return false;
+ }
+
+override public Boolean lt(Num rhs)
+ {
+ return rhs.gt(val);
+ }
+
+override public Boolean gt(BigInteger x)
+ {
+ return x.compareTo(BigInteger.valueOf(val)) < 0;
+ }
+
+override public Boolean gt(int x)
+ {
+ return x < val;
+ }
+
+override public Boolean gt(RatioNum x)
+ {
+ return x.numerator.lt(x.denominator.multiply(val));
+ }
+
+override public Num add(Num rhs)
+ {
+ return rhs.addTo(val);
+ }
+
+override public Num addTo(BigInteger x)
+ {
+ return Num.from(x.add(BigInteger.valueOf(val)));
+ }
+
+override public Num addTo(int x)
+ {
+ return Num.from((long) x + val);
+ }
+
+override public Num addTo(RatioNum x)
+ {
+ return x.addTo(val);
+ }
+
+override public Num subtractFrom(Num x)
+ {
+ return x.addTo(-val);
+ }
+
+override public Num multiplyBy(Num rhs)
+ {
+ return rhs.multiply(val);
+ }
+
+override public Num multiply(BigInteger x)
+ {
+ return Num.from(x.multiply(BigInteger.valueOf(val)));
+ }
+
+override public Num multiply(int x)
+ {
+ return Num.from((long) x * val);
+ }
+
+override public Num multiply(RatioNum x)
+ {
+ return x.multiply(val);
+ }
+
+override public Object truncateDivide(ThreadLocalData tld, Num num)
+ {
+ return num.truncateBy(tld, val);
+ }
+
+override public Object truncateBy(ThreadLocalData tld, int div)
+ {
+ return RT.setValues(tld, Num.from(val / div), Num.from(val % div));
+ }
+
+override public Object truncateBy(ThreadLocalData tld, BigInteger div)
+ {
+ return Num.truncateBigints(tld, BigInteger.valueOf(val), div);
+ }
+
+override public Object truncateBy(ThreadLocalData tld, RatioNum div)
+ {
+ Num q = (Num) Num.truncate(tld, div.denominator.multiply(val), div.numerator);
+ return RT.setValues(tld, q, q.multiplyBy(div).subtractFrom(this));
+ }
+
+override public Num divideBy(Num rhs)
+ {
+ return rhs.divide(val);
+ }
+
+override public Num divide(BigInteger n)
+ {
+ return Num.divide(n, BigInteger.valueOf(val));
+ }
+
+static int gcdf(int u, int v)
+ {
+ while(v != 0)
+ {
+ int r = u % v;
+ u = v;
+ v = r;
+ }
+ return u;
+ }
+
+override public Num divide(int n)
+ {
+ int gcd = gcdf(n, val);
+ if(gcd == 0)
+ return Num.ZERO;
+
+ n = n / gcd;
+ int d = val / gcd;
+ if(d == 1)
+ return Num.from(n);
+ if(d < 0)
+ {
+ n = -n;
+ d = -d;
+ }
+ return new RatioNum((IntegerNum) Num.from(n), (IntegerNum) Num.from(d));
+ }
+
+override public Num divide(RatioNum x)
+ {
+ return Num.divide(x.numerator, x.denominator.multiply(val));
+ }
+
+override public Num negate()
+ {
+ return Num.from(-val);
+ }
+
+override public Boolean minusp()
+ {
+ return val < 0;
+ }
+
+override public Boolean plusp()
+ {
+ return val > 0;
+ }
+
+override public Num oneMinus()
+ {
+ return Num.from(val - 1);
+ }
+
+override public Num onePlus()
+ {
+ return Num.from(val + 1);
+ }
+
+}
+}
diff --git a/src/cli/runtime/FloatNum.cs b/src/cli/runtime/FloatNum.cs
new file mode 100644
index 00000000..3031e4f6
--- /dev/null
+++ b/src/cli/runtime/FloatNum.cs
@@ -0,0 +1,21 @@
+/**
+ * Copyright (c) Rich Hickey. All rights reserved.
+ * The use and distribution terms for this software are covered by the
+ * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
+ * which can be found in the file CPL.TXT at the root of this distribution.
+ * By using this software in any fashion, you are agreeing to be bound by
+ * the terms of this license.
+ * You must not remove this notice, or any other, from this software.
+ **/
+
+/* rich Mar 28, 2006 10:17:21 AM */
+
+using System;
+
+namespace org.clojure.runtime
+{
+
+public abstract class FloatNum : RealNum {
+
+}
+}
diff --git a/src/cli/runtime/IFn.cs b/src/cli/runtime/IFn.cs
new file mode 100644
index 00000000..e96fd902
--- /dev/null
+++ b/src/cli/runtime/IFn.cs
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) Rich Hickey. All rights reserved.
+ * The use and distribution terms for this software are covered by the
+ * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
+ * which can be found in the file CPL.TXT at the root of this distribution.
+ * By using this software in any fashion, you are agreeing to be bound by
+ * the terms of this license.
+ * You must not remove this notice, or any other, from this software.
+ **/
+
+/* rich Mar 25, 2006 3:54:03 PM */
+
+using System;
+
+namespace org.clojure.runtime
+{
+public interface IFn{
+
+Object invoke(ThreadLocalData tld) /*throws Exception*/;
+
+Object invoke(ThreadLocalData tld, Object arg1) /*throws Exception*/;
+
+Object invoke(ThreadLocalData tld, Object arg1, Object arg2) /*throws Exception*/;
+
+Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3) /*throws Exception*/;
+
+Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4) /*throws Exception*/;
+
+Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5)
+ /*throws Exception*/;
+
+Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5,
+ Cons args) /*throws Exception*/;
+
+Object applyTo(ThreadLocalData tld, Cons arglist) /*throws Exception*/;
+}
+}
diff --git a/src/cli/runtime/IntegerNum.cs b/src/cli/runtime/IntegerNum.cs
new file mode 100644
index 00000000..7e24b1e6
--- /dev/null
+++ b/src/cli/runtime/IntegerNum.cs
@@ -0,0 +1,21 @@
+/**
+ * Copyright (c) Rich Hickey. All rights reserved.
+ * The use and distribution terms for this software are covered by the
+ * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
+ * which can be found in the file CPL.TXT at the root of this distribution.
+ * By using this software in any fashion, you are agreeing to be bound by
+ * the terms of this license.
+ * You must not remove this notice, or any other, from this software.
+ **/
+
+/* rich Mar 28, 2006 10:11:55 AM */
+
+using System;
+
+namespace org.clojure.runtime
+{
+
+public abstract class IntegerNum : RationalNum {
+
+}
+} \ No newline at end of file
diff --git a/src/cli/runtime/Keyword.cs b/src/cli/runtime/Keyword.cs
new file mode 100644
index 00000000..8748cdf1
--- /dev/null
+++ b/src/cli/runtime/Keyword.cs
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) Rich Hickey. All rights reserved.
+ * The use and distribution terms for this software are covered by the
+ * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
+ * which can be found in the file CPL.TXT at the root of this distribution.
+ * By using this software in any fashion, you are agreeing to be bound by
+ * the terms of this license.
+ * You must not remove this notice, or any other, from this software.
+ **/
+
+/* rich Mar 29, 2006 10:39:05 AM */
+
+using System;
+
+namespace org.clojure.runtime
+{
+
+public class Keyword : Symbol
+ {
+/**
+ * Used by Namespace.intern()
+ *
+ * @param name
+ * @param ns
+ */
+internal Keyword(String name, Namespace ns):
+ base(name, ns)
+
+ {
+ this.val = this;
+ this.fn = this;
+ }
+
+override public Object getValue(ThreadLocalData tld)
+ {
+ return this;
+ }
+
+override public Object setValue(ThreadLocalData tld, Object val)
+ {
+ throw new InvalidOperationException("Cannot set the value of a keyword");
+ }
+
+override public String ToString()