Generic API providing document evaluation utilities.
Generic API providing document evaluation utilities.
(eval-doc {:prose.alpha.document/keys [path slurp-doc read-doc eval-forms]
:as env})
Evaluate a document.
Takes care of binding fr.jeremyschoffen.prose.alpha.eval.common/*evaluation-env*
using its parameter.
This function takes one argument which is a map. The keys are as follow:
path
: a string, the path to the documentslurp-doc
: a function that takes a path to a file and return the text content of that fileread-doc
: a reader / parser function, text in, code (data) outeval-forms
: an evaluation function, takes a sequence of forms and returns the sequence of evaluationsEvaluate a document. Takes care of binding [[fr.jeremyschoffen.prose.alpha.eval.common/*evaluation-env*]] using its parameter. This function takes one argument which is a map. The keys are as follow: - `path`: a string, the path to the document - `slurp-doc`: a function that takes a path to a file and return the text content of that file - `read-doc`: a reader / parser function, text in, code (data) out - `eval-forms`: an evaluation function, takes a sequence of forms and returns the sequence of evaluations
(make {slurp-doc :slurp-doc read-doc :read-doc efs :eval-forms})
Make an evaluation function that uses eval-doc
under the hood.
Takes a map as an argument with the following keys:
:slurp-doc
: a function that takes a path to a file and return the text content of that file:read-doc
: a reader function, text in, code (data) out:eval-forms
: an evaluation function, takes a sequence of forms and returns the sequence of evaluationsReturns a function that takes a path and optionally some input as arguments and returns the evaluated document.
The input if present is added to fr.jeremyschoffen.prose.alpha.eval.common/*evaluation-env*
under the key
:prose.alpha.document/input {}
For instance:
(def my-eval-doc
(make {:slurp-doc sd
:read-doc read-from-string
:eval-forms eval-forms}))
(my-eval-doc "path/to/doc" {:some :input})
Make an evaluation function that uses [[eval-doc]] under the hood. Takes a map as an argument with the following keys: - `:slurp-doc`: a function that takes a path to a file and return the text content of that file - `:read-doc`: a reader function, text in, code (data) out - `:eval-forms`: an evaluation function, takes a sequence of forms and returns the sequence of evaluations Returns a function that takes a path and optionally some input as arguments and returns the evaluated document. The input if present is added to [[fr.jeremyschoffen.prose.alpha.eval.common/*evaluation-env*]] under the key `:prose.alpha.document/input {}` For instance: ```clojure (def my-eval-doc (make {:slurp-doc sd :read-doc read-from-string :eval-forms eval-forms})) (my-eval-doc "path/to/doc" {:some :input}) ```
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close