JennyToy
JennyToy

Reputation: 628

Looping through elements of set

I have a seteq which can have any number of elements (the elements are integers). For example

#<seteq: 1 2 3>

How do I loop through the elements of this set randomly?

Upvotes: 1

Views: 38

Answers (1)

C. K. Young
C. K. Young

Reputation: 223023

The easiest way is to use a for comprehension:

(for ([item (in-set my-set)])
  (displayln item))

Upvotes: 2

Related Questions