I try to fill a binary tree with 5 random numbers, avoiding duplicates. Is 
there a more elegant way than this (using "Iterations and Comprehensions")?

(define tree4
  (do ([x (random 10) (random 10)]
       [c #f (contains? tree x)]
       [tree null (if c tree (insert tree x))]
       [i 0 (if c i (add1 i))])
    [(>= i 5) tree]))

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to