In Paren
(set contains? (fn (x lst)
(set found false)
(set i (dec (length lst)))
(while (&& (>= i 0) (! found))
(when (== x (nth i lst))
(set found true))
(-- i))
found))
(set lotto (fn ()
(set r (list))
(while (< (length r) 6)
(set x (inc (int (* (rand) 45))))
(when (! (contains? x r))
(set r (cons x r))))
(prn r)))
(lotto)
'My Computer Programs' 카테고리의 다른 글
(newLISP) 로또 번호 생성 (0) | 2013.07.26 |
---|---|
(newlisp) port scan (0) | 2013.07.22 |
(Clojure) 로또 번호 생성 (0) | 2013.06.19 |
(Parenjs) 로또 번호 생성 (0) | 2013.06.17 |
(JavaScript) Sort List (0) | 2013.06.10 |