diff options
author | Rich Hickey <richhickey@gmail.com> | 2006-03-28 01:29:48 +0000 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2006-03-28 01:29:48 +0000 |
commit | 28c9cecb7ce4ad5945ae749e8e6356b3fa3f69a9 (patch) | |
tree | bea96b18b2eecb36e81137fdec6cd91b4ee26429 /src | |
parent | 60d5204f86972c94429009b7e97f554ba8c49f36 (diff) |
added RestFns
Diffstat (limited to 'src')
-rw-r--r-- | src/org/clojure/runtime/RestFn0.java | 60 | ||||
-rw-r--r-- | src/org/clojure/runtime/RestFn1.java | 59 | ||||
-rw-r--r-- | src/org/clojure/runtime/RestFn2.java | 56 | ||||
-rw-r--r-- | src/org/clojure/runtime/RestFn3.java | 52 | ||||
-rw-r--r-- | src/org/clojure/runtime/RestFn4.java | 49 | ||||
-rw-r--r-- | src/org/clojure/runtime/RestFn5.java | 45 |
6 files changed, 321 insertions, 0 deletions
diff --git a/src/org/clojure/runtime/RestFn0.java b/src/org/clojure/runtime/RestFn0.java new file mode 100644 index 00000000..b6886c8b --- /dev/null +++ b/src/org/clojure/runtime/RestFn0.java @@ -0,0 +1,60 @@ +/** + * 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 7:34:25 PM */ + +package org.clojure.runtime; + +public abstract class RestFn0 extends AFn{ + +protected abstract Object doInvoke(ThreadLocalData tld, Cons rest) throws Exception; + +public Object applyTo(ThreadLocalData tld, Cons arglist) throws Exception + { + return doInvoke(tld, arglist); + } + +public Object invoke(ThreadLocalData tld) throws Exception + { + return doInvoke(tld, null); + } + +public Object invoke(ThreadLocalData tld, Object arg1) throws Exception + { + return doInvoke(tld, RT.list(arg1)); + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2) throws Exception + { + return doInvoke(tld, RT.list(arg1, arg2)); + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3) throws Exception + { + return doInvoke(tld, RT.list(arg1, arg2, arg3)); + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4) throws Exception + { + return doInvoke(tld, RT.list(arg1, arg2, arg3, arg4)); + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) + throws Exception + { + return doInvoke(tld, RT.list(arg1, arg2, arg3, arg4, arg5)); + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Cons args) + throws Exception + { + return doInvoke(tld, RT.listStar(arg1, arg2, arg3, arg4, arg5, args)); + } +} diff --git a/src/org/clojure/runtime/RestFn1.java b/src/org/clojure/runtime/RestFn1.java new file mode 100644 index 00000000..6031d455 --- /dev/null +++ b/src/org/clojure/runtime/RestFn1.java @@ -0,0 +1,59 @@ +/** + * 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:00:28 PM */ + +package org.clojure.runtime; + +public abstract class RestFn1 extends AFn{ + +protected abstract Object doInvoke(ThreadLocalData tld, Object arg1, Cons rest) throws Exception; + +public Object applyTo(ThreadLocalData tld, Cons arglist) throws Exception + { + if(arglist == null) + throwArity(); + return doInvoke(tld, arglist.first + , arglist.rest); + } + +public Object invoke(ThreadLocalData tld, Object arg1) throws Exception + { + return doInvoke(tld, arg1, null); + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2) throws Exception + { + return doInvoke(tld, arg1, RT.list(arg2)); + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3) throws Exception + { + return doInvoke(tld, arg1, RT.list(arg2, arg3)); + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4) throws Exception + { + return doInvoke(tld, arg1, RT.list(arg2, arg3, arg4)); + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) + throws Exception + { + return doInvoke(tld, arg1, RT.list(arg2, arg3, arg4, arg5)); + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Cons args) + throws Exception + { + return doInvoke(tld, arg1, RT.listStar(arg2, arg3, arg4, arg5, args)); + } +} + diff --git a/src/org/clojure/runtime/RestFn2.java b/src/org/clojure/runtime/RestFn2.java new file mode 100644 index 00000000..b244657a --- /dev/null +++ b/src/org/clojure/runtime/RestFn2.java @@ -0,0 +1,56 @@ +/** + * 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:05:10 PM */ + +package org.clojure.runtime; + +public abstract class RestFn2 extends AFn{ + +protected abstract Object doInvoke(ThreadLocalData tld, Object arg1, Object arg2, Cons rest) throws Exception; + +public Object applyTo(ThreadLocalData tld, Cons arglist) throws Exception + { + if(RT.boundedLength(arglist, 2) < 2) + throwArity(); + return doInvoke(tld, arglist.first + , (arglist = arglist.rest).first + , arglist.rest); + + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2) throws Exception + { + return doInvoke(tld, arg1, arg2, null); + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3) throws Exception + { + return doInvoke(tld, arg1, arg2, RT.list(arg3)); + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4) throws Exception + { + return doInvoke(tld, arg1, arg2, RT.list(arg3, arg4)); + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) + throws Exception + { + return doInvoke(tld, arg1, arg2, RT.list(arg3, arg4, arg5)); + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Cons args) + throws Exception + { + return doInvoke(tld, arg1, arg2, RT.listStar(arg3, arg4, arg5, args)); + } +} + diff --git a/src/org/clojure/runtime/RestFn3.java b/src/org/clojure/runtime/RestFn3.java new file mode 100644 index 00000000..cd254af6 --- /dev/null +++ b/src/org/clojure/runtime/RestFn3.java @@ -0,0 +1,52 @@ +/** + * 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:19:54 PM */ + +package org.clojure.runtime; + +public abstract class RestFn3 extends AFn{ + +protected abstract Object doInvoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Cons rest) throws Exception; + +public Object applyTo(ThreadLocalData tld, Cons arglist) throws Exception + { + if(RT.boundedLength(arglist, 3) < 3) + throwArity(); + return doInvoke(tld, arglist.first + , (arglist = arglist.rest).first + , (arglist = arglist.rest).first + , arglist.rest); + + } + + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3) throws Exception + { + return doInvoke(tld, arg1, arg2, arg3,null); + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4) throws Exception + { + return doInvoke(tld, arg1, arg2, arg3, RT.list(arg4)); + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) + throws Exception + { + return doInvoke(tld, arg1, arg2, arg3, RT.list(arg4, arg5)); + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Cons args) + throws Exception + { + return doInvoke(tld, arg1, arg2, arg3, RT.listStar(arg4, arg5, args)); + } +} diff --git a/src/org/clojure/runtime/RestFn4.java b/src/org/clojure/runtime/RestFn4.java new file mode 100644 index 00000000..c6886bb4 --- /dev/null +++ b/src/org/clojure/runtime/RestFn4.java @@ -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 27, 2006 8:21:51 PM */ + +package org.clojure.runtime; + +public abstract class RestFn4 extends AFn{ + +protected abstract Object doInvoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4, Cons rest) + throws Exception; + +public Object applyTo(ThreadLocalData tld, Cons arglist) throws Exception + { + if(RT.boundedLength(arglist, 4) < 4) + throwArity(); + return doInvoke(tld, arglist.first + , (arglist = arglist.rest).first + , (arglist = arglist.rest).first + , (arglist = arglist.rest).first + , arglist.rest); + + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4) throws Exception + { + return doInvoke(tld, arg1, arg2, arg3, arg4, null); + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) + throws Exception + { + return doInvoke(tld, arg1, arg2, arg3, arg4, RT.list(arg5)); + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Cons args) + throws Exception + { + return doInvoke(tld, arg1, arg2, arg3, arg4, RT.listStar(arg5, args)); + } +} + diff --git a/src/org/clojure/runtime/RestFn5.java b/src/org/clojure/runtime/RestFn5.java new file mode 100644 index 00000000..b1fef34b --- /dev/null +++ b/src/org/clojure/runtime/RestFn5.java @@ -0,0 +1,45 @@ +/** + * 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:24:31 PM */ + +package org.clojure.runtime; + +public abstract class RestFn5 extends AFn{ + +protected abstract Object doInvoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, + Cons rest) + throws Exception; + +public Object applyTo(ThreadLocalData tld, Cons arglist) throws Exception + { + if(RT.boundedLength(arglist, 5) < 5) + throwArity(); + return doInvoke(tld, arglist.first + , (arglist = arglist.rest).first + , (arglist = arglist.rest).first + , (arglist = arglist.rest).first + , (arglist = arglist.rest).first + , arglist.rest); + + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) + throws Exception + { + return doInvoke(tld, arg1, arg2, arg3, arg4, arg5, null); + } + +public Object invoke(ThreadLocalData tld, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Cons args) + throws Exception + { + return doInvoke(tld, arg1, arg2, arg3, arg4, arg5, args); + } +} |