(create-executive-form name fields settings body)creates the form for defexecutive
(create-executive-form '-EXE- '[name place date] {:type 'deftype :tag "hello" :invoke 'hello-invoke :display 'hello-display :print 'hello-print :args-number 3} []) => '[(deftype -EXE- [name place date] java.lang.Object (toString [hello] (clojure.core/str "#" "hello" (hello-display hello)))
clojure.lang.IFn
(invoke [hello] (hello-invoke hello))
(invoke [hello a0] (hello-invoke hello a0))
(invoke [hello a0 a1] (hello-invoke hello a0 a1))
(applyTo [hello args] (clojure.core/apply hello-invoke hello args)))
(clojure.core/defmethod clojure.core/print-method (clojure.core/resolve (quote -EXE-))
[hello writer]
(.write writer (clojure.core/str (hello-print hello))))]
creates the form for defexecutive
(create-executive-form '-EXE-
'[name place date]
{:type 'deftype
:tag "hello"
:invoke 'hello-invoke
:display 'hello-display
:print 'hello-print
:args-number 3}
[])
=> '[(deftype -EXE- [name place date]
java.lang.Object
(toString [hello]
(clojure.core/str "#" "hello" (hello-display hello)))
clojure.lang.IFn
(invoke [hello] (hello-invoke hello))
(invoke [hello a0] (hello-invoke hello a0))
(invoke [hello a0 a1] (hello-invoke hello a0 a1))
(applyTo [hello args] (clojure.core/apply hello-invoke hello args)))
(clojure.core/defmethod clojure.core/print-method (clojure.core/resolve (quote -EXE-))
[hello writer]
(.write writer (clojure.core/str (hello-print hello))))](create-invoke-form method this n)creates an invoke form given params
(create-invoke-form '-hello- 'obj 3) => '(invoke [obj a0 a1 a2] (-hello- obj a0 a1 a2))
creates an invoke form given params (create-invoke-form '-hello- 'obj 3) => '(invoke [obj a0 a1 a2] (-hello- obj a0 a1 a2))
(create-print-form this name print)creates a print-method form for object
(create-print-form 'v 'Stuff 'print-custom) => '(clojure.core/defmethod clojure.core/print-method (clojure.core/resolve (quote Stuff)) [v writer] (.write writer (clojure.core/str (print-custom v))))
creates a print-method form for object
(create-print-form 'v 'Stuff 'print-custom)
=> '(clojure.core/defmethod clojure.core/print-method
(clojure.core/resolve (quote Stuff)) [v writer]
(.write writer (clojure.core/str (print-custom v))))(defexecutive name doc? attrs? & [fields settings & body])creates an executable data type
(declare hello-display hello-print)
(def hello-invoke (fn [this & args] (str (.name this) " " (apply + args))))
(defexecutive -Hello- [name place date] {:tag "hello" :invoke hello-invoke :display hello-display :print hello-print})
((-Hello-. "hello" nil nil) 1 2 3 4 5) => "hello 15"
creates an executable data type
(declare hello-display hello-print)
(def hello-invoke (fn [this & args]
(str (.name this) " " (apply + args))))
(defexecutive -Hello- [name place date]
{:tag "hello"
:invoke hello-invoke
:display hello-display
:print hello-print})
((-Hello-. "hello" nil nil) 1 2 3 4 5)
=> "hello 15"cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |