(define (test lst)
(let (len (length lst))
(dolist (el lst)
; select and index of the list different from the current
(while (!= (setq idx (rand len)) $idx)))
(println "index: " idx)))
Why (test '(1 2 3 4 5)) fall (almost always) into an infinite loop?