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) )
)
)
August 19, 2024
lisp
(defun inverte (lista)
(inverte-aux lista () )
)
(defun inverte-aux (lista resto)
(if (null lista)
resto
(inverte-aux (rest lista) (cons (first lista) resto) )
)
)
Don't have an account? We will create one for you.
Enter the OTP send to
in seconds.