summaryrefslogtreecommitdiff
path: root/src/cli/runtime/RestFn1.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli/runtime/RestFn1.cs')
-rw-r--r--src/cli/runtime/RestFn1.cs18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/cli/runtime/RestFn1.cs b/src/cli/runtime/RestFn1.cs
index 60f59747..822058f5 100644
--- a/src/cli/runtime/RestFn1.cs
+++ b/src/cli/runtime/RestFn1.cs
@@ -20,12 +20,18 @@ public abstract class RestFn1 : AFn{
public abstract Object doInvoke(ThreadLocalData tld, Object arg1, Cons rest) /*throws Exception*/;
override public Object applyTo(ThreadLocalData tld, Cons arglist) /*throws Exception*/
- {
- if(arglist == null)
- throwArity();
- return doInvoke(tld, arglist.first
- , arglist.rest);
- }
+ {
+ switch (RT.boundedLength(arglist, 1))
+ {
+ case 0:
+ return invoke(tld);
+ case 1:
+ return invoke(tld, arglist.first);
+ default:
+ return doInvoke(tld, arglist.first
+ , arglist.rest);
+ }
+ }
override public Object invoke(ThreadLocalData tld, Object arg1) /*throws Exception*/
{