Liking cljdoc? Tell your friends :D

robert.hooke

Hooke your functions!

(defn examine [x] (println x))

(defn microscope "The keen powers of observation enabled by Robert Hooke allow for a closer look at any object!" [f x] (f (.toUpperCase (str x))))

(defn doubler [f & args] (apply f args) (apply f args))

(defn telescope [f x] (f (apply str (interpose " " x))))

(add-hook #'examine #'microscope) (add-hook #'examine #'doubler) (add-hook #'examine #'telescope)

;; Now when we examine something: (examine "something")

S O M E T H I N G S O M E T H I N G

Use the add-hook function to wrap a function in your a hook.

Hooke your functions!

  (defn examine [x]
    (println x))

  (defn microscope
    "The keen powers of observation enabled by Robert Hooke allow
    for a closer look at any object!"
    [f x]
    (f (.toUpperCase (str x))))

  (defn doubler [f & args]
    (apply f args)
    (apply f args))

  (defn telescope [f x]
    (f (apply str (interpose " " x))))

  (add-hook #'examine #'microscope)
  (add-hook #'examine #'doubler)
  (add-hook #'examine #'telescope)

  ;; Now when we examine something:
  (examine "something")
  > S O M E T H I N G
  > S O M E T H I N G

Use the add-hook function to wrap a function in your a hook.

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close