SunDawning avatar

Answer: LISP conditional loops

sundawning

Published: 08 May 2018 › Updated: 08 May 2018Answer: LISP conditional loops

Answer: LISP conditional loops

Question: https://stackoverflow.com/questions/50204220/

Snapshot:

The actual solution steps will be similar to the following, because the problem does not provide the relevant functions, the list as an example, can not solve the problem best:

(let ((population-amount 10)
      (all-guess '()))
  (loop
     (if (= (length
             (setf all-guess
                   (remove-duplicates all-guess)))
            population-amount)
         ;; exit when all-guess's items are unique
         (return all-guess)
         ;; make new guess, for example, a random number [0,9]
         (push (random 10)
               all-guess))))

Return:

(7 9 5 2 4 8 1 6 0 3)

Or

(5 8 3 1 0 9 7 4 2 6)

Or etc.

Leave Answer: LISP conditional loops to:

Written by

Read more #common-lisp posts


Best Posts From SunDawning

We have not curated any of sundawning's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From SunDawning