August 19, 2024

P05 - Reverse a list

lisp

(defun inverte (lista)
  (inverte-aux lista () )
  )

(defun inverte-aux (lista resto)
  (if (null lista)
      resto
    (inverte-aux (rest lista) (cons (first lista) resto) )
    )
  )
Be first to comment
Leave a reply