RosettaCodeData/Task/Search-a-list/Clojure/search-a-list.clj
2023-07-01 13:44:08 -04:00

5 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)))