Return lower value from a list - Lisp

Asked

Viewed 61 times

1

I want to return the smallest value of a list with an iterative function in Lisp. The code I have is this::

 (defun rmin (lista)
(let ((minim (first lista))) (loop for a in (lista) (if (< a minim) (minim a))) minim)) 

My idea was to replace the initial variable (minim) for a when it finds a lower value in the list, and at the end of the cycle returns the lower value found.

  • Which compiler or interpreter you are using to run the program?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.