Reputation: 5652
I'm writing a mini-shell thing for fun, and I'm trying to define a map of commands where one of the commands is help
. help
should print all available commands, and I (try to) do this by looping through the keys of the commands
map, but since help
is part of it, no matter which order I define them in, I always get a Use of undeclared variable
-warning.
How do I solve this?
(def commands {:help help})
(defn help []
(echo! "The available commands are:")
(doseq [available-command (keys commands)]
(echo! (name available-command))))
Upvotes: 1
Views: 138