Liking cljdoc? Tell your friends :D

clojure.main

Top-level main function for Clojure REPL and scripts.

Top-level main function for Clojure REPL and scripts.
raw docstring

demungeclj

(demunge fn-name)

Given a string representation of a fn class, as in a stack trace element, returns a readable version.

Given a string representation of a fn class,
as in a stack trace element, returns a readable version.
sourceraw docstring

ex-strclj

(ex-str {:clojure.error/keys [phase source line column symbol class cause spec]
         :as triage-data})

Returns a string from exception data, as produced by ex-triage. The first line summarizes the exception phase and location. The subsequent lines describe the cause.

Returns a string from exception data, as produced by ex-triage.
The first line summarizes the exception phase and location.
The subsequent lines describe the cause.
sourceraw docstring

ex-triageclj

(ex-triage datafied-throwable)

Returns an analysis of the phase, error, cause, and location of an error that occurred based on Throwable data, as returned by Throwable->map. All attributes other than phase are optional: :clojure.error/phase - keyword phase indicator, one of: :read-source :compile-syntax-check :compilation :macro-syntax-check :macroexpansion :execution :read-eval-result :print-eval-result :clojure.error/source - file name (no path) :clojure.error/line - integer line number :clojure.error/column - integer column number :clojure.error/symbol - symbol being expanded/compiled/invoked :clojure.error/class - cause exception class symbol :clojure.error/cause - cause exception message :clojure.error/spec - explain-data for spec error

Returns an analysis of the phase, error, cause, and location of an error that occurred
based on Throwable data, as returned by Throwable->map. All attributes other than phase
are optional:
  :clojure.error/phase - keyword phase indicator, one of:
    :read-source :compile-syntax-check :compilation :macro-syntax-check :macroexpansion
    :execution :read-eval-result :print-eval-result
  :clojure.error/source - file name (no path)
  :clojure.error/line - integer line number
  :clojure.error/column - integer column number
  :clojure.error/symbol - symbol being expanded/compiled/invoked
  :clojure.error/class - cause exception class symbol
  :clojure.error/cause - cause exception message
  :clojure.error/spec - explain-data for spec error
sourceraw docstring

load-scriptclj

(load-script path)

Loads Clojure source from a file or resource given its path. Paths beginning with @ or @/ are considered relative to classpath.

Loads Clojure source from a file or resource given its path. Paths
beginning with @ or @/ are considered relative to classpath.
sourceraw docstring

mainclj

(main & args)

Usage: java -cp clojure.jar clojure.main [init-opt*] [main-opt] [arg*]

With no options or args, runs an interactive Read-Eval-Print Loop

init options: -i, --init path Load a file or resource -e, --eval string Evaluate expressions in string; print non-nil values

main options: -m, --main ns-name Call the -main function from a namespace with args -r, --repl Run a repl path Run a script from a file or resource

  •               Run a script from standard input
    

-h, -?, --help Print this help message and exit

operation:

  • Establishes thread-local bindings for commonly set!-able vars
  • Enters the user namespace
  • Binds command-line-args to a seq of strings containing command line args that appear after any main option
  • Runs all init options in order
  • Calls a -main function or runs a repl or script if requested

The init options may be repeated and mixed freely, but must appear before any main option. The appearance of any eval option before running a repl suppresses the usual repl greeting message: "Clojure ~(clojure-version)".

Paths may be absolute or relative in the filesystem or relative to classpath. Classpath-relative paths have prefix of @ or @/

Usage: java -cp clojure.jar clojure.main [init-opt*] [main-opt] [arg*]

With no options or args, runs an interactive Read-Eval-Print Loop

init options:
  -i, --init path     Load a file or resource
  -e, --eval string   Evaluate expressions in string; print non-nil values

main options:
  -m, --main ns-name  Call the -main function from a namespace with args
  -r, --repl          Run a repl
  path                Run a script from a file or resource
  -                   Run a script from standard input
  -h, -?, --help      Print this help message and exit

operation:

  - Establishes thread-local bindings for commonly set!-able vars
  - Enters the user namespace
  - Binds *command-line-args* to a seq of strings containing command line
    args that appear after any main option
  - Runs all init options in order
  - Calls a -main function or runs a repl or script if requested

The init options may be repeated and mixed freely, but must appear before
any main option. The appearance of any eval option before running a repl
suppresses the usual repl greeting message: "Clojure ~(clojure-version)".

Paths may be absolute or relative in the filesystem or relative to
classpath. Classpath-relative paths have prefix of @ or @/
sourceraw docstring

renumbering-readclj

(renumbering-read opts reader line-number)

Reads from reader, which must be a LineNumberingPushbackReader, while capturing the read string. If the read is successful, reset the line number and re-read. The line number on re-read is the passed line-number unless :line or :clojure.core/eval-file meta are explicitly set on the read value.

Reads from reader, which must be a LineNumberingPushbackReader, while capturing
the read string. If the read is successful, reset the line number and re-read.
The line number on re-read is the passed line-number unless :line or
:clojure.core/eval-file meta are explicitly set on the read value.
sourceraw docstring

replclj

(repl & options)

Generic, reusable, read-eval-print loop. By default, reads from in, writes to out, and prints exception summaries to err. If you use the default :read hook, in must either be an instance of LineNumberingPushbackReader or duplicate its behavior of both supporting .unread and collapsing CR, LF, and CRLF into a single \newline. Options are sequential keyword-value pairs. Available options and their defaults:

  • :init, function of no arguments, initialization hook called with bindings for set!-able vars in place. default: #()

  • :need-prompt, function of no arguments, called before each read-eval-print except the first, the user will be prompted if it returns true. default: (if (instance? LineNumberingPushbackReader in) #(.atLineStart in) #(identity true))

  • :prompt, function of no arguments, prompts for more input. default: repl-prompt

  • :flush, function of no arguments, flushes output default: flush

  • :read, function of two arguments, reads from in:

    • returns its first argument to request a fresh prompt
      • depending on need-prompt, this may cause the repl to prompt before reading again
    • returns its second argument to request an exit from the repl
    • else returns the next object read from the input stream default: repl-read
  • :eval, function of one argument, returns the evaluation of its argument default: eval

  • :print, function of one argument, prints its argument to the output default: prn

  • :caught, function of one argument, a throwable, called when read, eval, or print throws an exception or error default: repl-caught

Generic, reusable, read-eval-print loop. By default, reads from *in*,
writes to *out*, and prints exception summaries to *err*. If you use the
default :read hook, *in* must either be an instance of
LineNumberingPushbackReader or duplicate its behavior of both supporting
.unread and collapsing CR, LF, and CRLF into a single \newline. Options
are sequential keyword-value pairs. Available options and their defaults:

   - :init, function of no arguments, initialization hook called with
     bindings for set!-able vars in place.
     default: #()

   - :need-prompt, function of no arguments, called before each
     read-eval-print except the first, the user will be prompted if it
     returns true.
     default: (if (instance? LineNumberingPushbackReader *in*)
                #(.atLineStart *in*)
                #(identity true))

   - :prompt, function of no arguments, prompts for more input.
     default: repl-prompt

   - :flush, function of no arguments, flushes output
     default: flush

   - :read, function of two arguments, reads from *in*:
       - returns its first argument to request a fresh prompt
         - depending on need-prompt, this may cause the repl to prompt
           before reading again
       - returns its second argument to request an exit from the repl
       - else returns the next object read from the input stream
     default: repl-read

   - :eval, function of one argument, returns the evaluation of its
     argument
     default: eval

   - :print, function of one argument, prints its argument to the output
     default: prn

   - :caught, function of one argument, a throwable, called when
     read, eval, or print throws an exception or error
     default: repl-caught
sourceraw docstring

repl-caughtclj

(repl-caught e)

Default :caught hook for repl

Default :caught hook for repl
sourceraw docstring

repl-exceptionclj

(repl-exception throwable)

Returns the root cause of throwables

Returns the root cause of throwables
sourceraw docstring

repl-promptclj

(repl-prompt)

Default :prompt hook for repl

Default :prompt hook for repl
sourceraw docstring

repl-readclj

(repl-read request-prompt request-exit)

Default :read hook for repl. Reads from in which must either be an instance of LineNumberingPushbackReader or duplicate its behavior of both supporting .unread and collapsing all of CR, LF, and CRLF into a single \newline. repl-read:

  • skips whitespace, then
    • returns request-prompt on start of line, or
    • returns request-exit on end of stream, or
    • reads an object from the input stream, then
      • skips the next input character if it's end of line, then
      • returns the object.
Default :read hook for repl. Reads from *in* which must either be an
instance of LineNumberingPushbackReader or duplicate its behavior of both
supporting .unread and collapsing all of CR, LF, and CRLF into a single
\newline. repl-read:
  - skips whitespace, then
    - returns request-prompt on start of line, or
    - returns request-exit on end of stream, or
    - reads an object from the input stream, then
      - skips the next input character if it's end of line, then
      - returns the object.
sourceraw docstring

repl-requiresclj

A sequence of lib specs that are applied to require by default when a new command-line REPL is started.

A sequence of lib specs that are applied to `require`
by default when a new command-line REPL is started.
sourceraw docstring

root-causeclj

(root-cause t)

Returns the initial cause of an exception or error by peeling off all of its wrappers

Returns the initial cause of an exception or error by peeling off all of
its wrappers
sourceraw docstring

skip-if-eolclj

(skip-if-eol s)

If the next character on stream s is a newline, skips it, otherwise leaves the stream untouched. Returns :line-start, :stream-end, or :body to indicate the relative location of the next character on s. The stream must either be an instance of LineNumberingPushbackReader or duplicate its behavior of both supporting .unread and collapsing all of CR, LF, and CRLF to a single \newline.

If the next character on stream s is a newline, skips it, otherwise
leaves the stream untouched. Returns :line-start, :stream-end, or :body
to indicate the relative location of the next character on s. The stream
must either be an instance of LineNumberingPushbackReader or duplicate
its behavior of both supporting .unread and collapsing all of CR, LF, and
CRLF to a single \newline.
sourceraw docstring

skip-whitespaceclj

(skip-whitespace s)

Skips whitespace characters on stream s. Returns :line-start, :stream-end, or :body to indicate the relative location of the next character on s. Interprets comma as whitespace and semicolon as comment to end of line. Does not interpret #! as comment to end of line because only one character of lookahead is available. The stream must either be an instance of LineNumberingPushbackReader or duplicate its behavior of both supporting .unread and collapsing all of CR, LF, and CRLF to a single \newline.

Skips whitespace characters on stream s. Returns :line-start, :stream-end,
or :body to indicate the relative location of the next character on s.
Interprets comma as whitespace and semicolon as comment to end of line.
Does not interpret #! as comment to end of line because only one
character of lookahead is available. The stream must either be an
instance of LineNumberingPushbackReader or duplicate its behavior of both
supporting .unread and collapsing all of CR, LF, and CRLF to a single
\newline.
sourceraw docstring

stack-element-strclj

(stack-element-str el)

Returns a (possibly unmunged) string representation of a StackTraceElement

Returns a (possibly unmunged) string representation of a StackTraceElement
sourceraw docstring

with-bindingscljmacro

(with-bindings & body)

Executes body in the context of thread-local bindings for several vars that often need to be set!: ns warn-on-reflection math-context print-meta print-length print-level compile-path command-line-args *1 *2 *3 *e

Executes body in the context of thread-local bindings for several vars
that often need to be set!: *ns* *warn-on-reflection* *math-context*
*print-meta* *print-length* *print-level* *compile-path*
*command-line-args* *1 *2 *3 *e
sourceraw docstring

with-read-knowncljmacro

(with-read-known & body)

Evaluates body with read-eval set to a "known" value, i.e. substituting true for :unknown if necessary.

Evaluates body with *read-eval* set to a "known" value,
i.e. substituting true for :unknown if necessary.
sourceraw docstring

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

× close