You're viewing version 1.2.0 of special-symbol?. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16

special-symbol?

clojure.core

  • (special-symbol? s)
Returns true if s names a special form

1 Example top

  • user=> (clojure-version)
    "1.4.0"
    ;; the set of special symbols for this clojure-version are the following:
    user=> (keys (. clojure.lang.Compiler specials))
    (deftype* new quote & var set! monitor-enter recur . case* clojure.core/import* reify* do fn* throw monitor-exit letfn* finally let* loop* try catch if def)
    
    ;; for example, "def" is not a function, not a macro, not even a var, but a special form:
    user=> (fn? 'def)
    false
    user=> (:macro (meta (find-var 'clojure.core/def)))
    nil
    user=> (find-var 'clojure.core/def)
    nil
    user=> (special-symbol? 'def)
    true
    
    ;; while "defn" is not a special form but a macro:
    user=> (special-symbol? 'defn)
    false
    user=> (:macro (meta (find-var 'clojure.core/defn)))
    true
    
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:3929 top

(defn special-symbol?
  "Returns true if s names a special form"
  {:added "1.0"}
  [s]
    (contains? (. clojure.lang.Compiler specials) s))
Vars in clojure.core/special-symbol?: contains? defn
Used in 1 other vars add-core-ns

Comments top

No comments for special-symbol?. Log in to add a comment.