Guest User

first-to-last

a guest
Jun 7th, 2019
117
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (defun first-to-last (L)
  2.   (labels ((fi-la (l)
  3.          (append (cdr l) (list (car l))))
  4.        (rec (x)
  5.          (cond ((null x) x)
  6.            ((atom (car x)) (cons (car x)
  7.                      (first-to-last (cdr x))))
  8.            (t (cons (fi-la (first-to-last (car x)))
  9.                 (rec (cdr x)))))))
  10.     (rec L)))
RAW Paste Data