Liking cljdoc? Tell your friends :D

deft.core


check-implementsclj

(check-implements obj-type protocol & {:keys [available-methods]})

Verify that a type T implements a protocol (as defined with defp).

A protocol is considered satisfied if, for every method in the protocol, there exists a multimethod implementation with dispatch value T

[obj-type protocol & {:keys [available-methods]}] obj-type: should be the dispatch value that is used for multimethods. for objects defined via deft, this is the keyword, so (deft Shape ...) would result in ::Shape protocol: the protocol to implement. If you define it with (defp Drawable ...) it's the variable stored in Drawable available-methods: a list of methods to restrict to. it's like saying, check if this protocol is satisfied, but assume that we can only see the value of these methods. It's useful for checking that all of the methods are defined in the same place (and not sporadically). If its nil, then it does no extra filtering.

Verify that a type T implements a protocol (as defined with defp).

A protocol is considered satisfied if, for every method in the protocol,
there exists a multimethod implementation with dispatch value T

[obj-type protocol & {:keys [available-methods]}]
obj-type: should be the _dispatch value_ that is used for multimethods.
  for objects defined via deft, this is the _keyword_, so (deft Shape ...)
  would result in ::Shape
protocol: the protocol to implement. If you define it with (defp Drawable ...)
  it's the variable stored in Drawable
available-methods: a list of methods to restrict to. it's like saying, check
  if this protocol is satisfied, but assume that we can only see the value of
  these methods. It's useful for checking that all of the methods are defined in the same place
  (and not sporadically). If its nil, then it does no extra filtering.
raw docstring

define-proto-implementationscljmacro

(define-proto-implementations type-obj type-name & record-implementations)

define-record-like-print-methodscljmacro

(define-record-like-print-methods type-name)

defntcljmacro

(defnt fn-name & rest-of-body)

defpcljmacro

(defp protocol-name & opts+sigs)

Define a (defp) protocol, which is essentially just a list of multimethods.

It uses the same syntax as defprotocol, e.g.

(defp Shape (area [this]))

[protocol-name keyword-options? & method-signatures] protocol-name: The name of the protocol keyword-options: Named arguments, so far this is only :external-methods -- a list of methods in this protocol where 'defmulti' is defined elsewhere. :extends -- a list of protocols that this protocol extends. This creates a union of all methods defined here and in the parent protocol method-signatures -- the actual methods to implement. for everything here, define a new 'defmulti' dispatching on type and then attach it to this protocol

Define a (defp) protocol, which is essentially just a list of multimethods.

It uses the same syntax as defprotocol, e.g.

(defp Shape
    (area [this]))

[protocol-name keyword-options? & method-signatures]
protocol-name: The name of the protocol
keyword-options: Named arguments, so far this is only
   :external-methods -- a list of methods in this protocol where 'defmulti' is defined elsewhere.
   :extends -- a list of protocols that this protocol extends. This creates a union of all methods defined here
               and in the parent protocol
method-signatures -- the actual methods to implement. for everything here, define a new 'defmulti' dispatching on type
   and then attach it to this protocol
raw docstring

deftcljmacro

(deft class-name inp-fields-list & record-implementations)

deft-fields-mapclj


get-method-impl-nameclj

(get-method-impl-name interface-name impl env)

get-method-impl-name-cljclj

(get-method-impl-name-clj interface-name impl)

get-method-impl-name-cljsclj

(get-method-impl-name-cljs interface-name impl env)

withtcljmacro

(witht def-list & code)

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close