
How to find max in lisp Java
Publicado por Shivam (1 intervención) el 25/11/2021 08:25:13
Hello All, I am trying to do Recursive method to find max value in list. Can anyone explain where I made the mistake on this code and how to approach it next time
I am using this online compiler also I tried this following method and didn't work:
Thanks a lot for any help. I am coming from java if that helps.
1
2
3
4
5
6
(defun f3 (i)
(setq x (cond (> (car (I)) (cdr (car (I))))
(f3 (cdr (I)))))
)
(f3 '(33 11 44 2) )
I am using this online compiler also I tried this following method and didn't work:
1
2
3
4
5
6
(defun f3 (i)
(cond ((null I )nil )
(setq x (car (i))
(f3(cdr (i)))
(return-from max x)
)
Thanks a lot for any help. I am coming from java if that helps.
Valora esta pregunta


0