Artifact 12e397d5c0ffd2cded6672eca11076709f10d723b70738b6fa093927d17f9000:
- Executable file
r37/lisp/csl/jlisp/AppendFn.java
— part of check-in
[f2fda60abd]
at
2011-09-02 18:13:33
on branch master
— Some historical releases purely for archival purposes
git-svn-id: https://svn.code.sf.net/p/reduce-algebra/code/trunk/historical@1375 2bfe0521-f11c-4a00-b80e-6202646ff360 (user: arthurcnorman@users.sourceforge.net, size: 771) [annotate] [blame] [check-ins using] [more...]
class AppendFn extends BuiltinFunction { public LispObject op0() { return Jlisp.nil; } public LispObject op1(LispObject arg1) { return arg1; } public LispObject op2(LispObject arg1, LispObject arg2) { LispObject r = Jlisp.nil; while (!arg1.atom) { LispObject a = arg1; r = new Cons(a.car, r); arg1 = a.cdr; } while (!r.atom) { LispObject a = r; r = a.cdr; a.cdr = arg2; arg2 = a; } return arg2; } public LispObject opn(LispObject [] args) { int n = args.length; LispObject r = args[--n]; for (int i=n-1; i>=0; i--) { r = op2(args[i], r); } return r; } }