Bulls and cows: Difference between revisions

Content added Content deleted
Line 2,707: Line 2,707:
; secret : (listof exact-nonnegative-integer?)
; secret : (listof exact-nonnegative-integer?)
(define secret
(define secret
(foldr (λ (n result) (cons n
(foldr (λ (n result)
(map (λ (y) (if (>= y n)
(cons n (map (λ (y) (if (>= y n)
(add1 y)
(add1 y)
y))
y))
result)))
result)))
'()
'()
(map random '(10 9 8 7))))
(map random '(10 9 8 7))))