How should this python be expressed
gl_enums = ... # map from name to values for opengl enums
# use with gl_enums["enum name"]
in clojure? This works, but is it right?
(def gl-enums ...) ; map from name to values for opengl enums
(defn gl-enum [k] (or (gl-enums k) (throw (SomeException.))))
; use with (gl-enum :enum-name)
edit: for clarification, this question is about the exception-throwing part, not the map-defining part
Your original example is OK. Two approaches you are also likely to come across:
More on clojure.core/if-let
More on clojure.core/contains?