Reputation: 1683
I have a list of files like so ("File1" "File2" "File3")
I want to turn this into a of radio-menu-items like this
(menu :text "Lists" :items [(radio-menu-item :text "File 1")(radio-menu-item :text "File 2")(radio-menu-item :text "File 3")])
I have tried looping like this
(def Radios (for [ item '("File1" "File2" "File3")] (radio-menu-item :text item)))
but this does not work.
How can this be accomplished?
Upvotes: 1
Views: 188
Reputation: 91557
your use of a for
expression looks correct, if I change the expression slightly so it returns the list it would run instead of running it we can verify this:
core> (list 'menu :text "Lists" :items
(vec (for [ item '("File1" "File2" "File3")]
(list 'radio-menu-item :text item))))
(menu :text "Lists" :items [(radio-menu-item :text "File1")
(radio-menu-item :text "File2")
(radio-menu-item :text "File3")])
so the finished expression becomes:
core> (menu :text "Lists" :items
(vec (for [ item '("File1" "File2" "File3")]
(radio-menu-item :text item))))
provided that menu
and radio-menu-item
resolve to the proper values.
Upvotes: 1