Arc Forumnew | comments | leaders | submitlogin
7 points by almkglor 6160 days ago | link | parent

  (def rev (xs)
    " Reverses a sequence. "
    ((afn (xs acc)
       (if (no xs)
           acc
           (self (cdr xs) (cons (car xs) acc))))
     xs nil))

  (defpat rev-pat
     (x)            (rev-pat x nil)
     ((x . xs) acc) (rev-pat xs (cons x acc))
     (()       acc) acc)