RosettaCodeData/Task/Search-a-list/Clojure/search-a-list.clj

6 lines
199 B
Clojure

(let [haystack ["Zig" "Zag" "Wally" "Ronald" "Bush" "Krusty" "Charlie" "Bush" "Bozo"]]
(let [idx (.indexOf haystack "Zig")]
(if (neg? idx)
(throw (Error. "item not found."))
idx)))