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.
raw docstring

add-hookclj

(add-hook target-var f)
(add-hook target-var key f)

Add a hook function f to target-var. Hook functions are passed the target function and all their arguments and must apply the target to the args if they wish to continue execution.

Add a hook function f to target-var. Hook functions are passed the
target function and all their arguments and must apply the target to
the args if they wish to continue execution.
sourceraw docstring

appendcljmacro

(append target-var & body)
source

clear-hooksclj

(clear-hooks target-var)

Remove all hooks from target-var.

Remove all hooks from target-var.
sourceraw docstring

end-scopeclj

(end-scope)
source

hook-scopesclj

source

prependcljmacro

(prepend target-var & body)
source

remove-hookclj

(remove-hook target-var key)

Remove hook identified by key from target-var.

Remove hook identified by key from target-var.
sourceraw docstring

start-scopeclj

(start-scope)
source

with-hooks-disabledcljmacro

(with-hooks-disabled f & body)
source

with-scopecljmacro

(with-scope & body)

Defines a scope which records any change to hooks during the dynamic extent of its body, and restores hooks to their original state on exit of the scope.

Defines a scope which records any change to hooks during the dynamic extent
of its body, and restores hooks to their original state on exit of the scope.
sourceraw docstring

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

× close