Get numbers for the lottery

前端 未结 3 1775
悲&欢浪女
悲&欢浪女 2021-01-15 01:45

As part of learning Lisp I\'m currently trying to write a function that helps me fill out my lottery ticket. I want that function to return

  • a list
  • of
3条回答
  •  梦谈多话
    2021-01-15 02:29

    (defun lotto ()
      (labels ((lot (acc)  
                 (if (= 6 (length acc)) 
                     acc 
                    (lot (adjoin (1+ (random 49)) acc)))))
        (sort (lot nil) #'<)))
    

提交回复
热议问题