Liking cljdoc? Tell your friends :D

com.positronic-solutions.pulley.cps


$bound-fncljmacro

($bound-fn & fn-tail)

Returns a function defined by the given fn-tail that, when called, will activate the same dynamic environment active in the thread at the time $bound-fn was called.

This is basically an "enhanced" version of clojure.core/bound-fn.

Returns a function defined by the given fn-tail that, when called,
will activate the same dynamic environment active in the thread
at the time $bound-fn was called.

This is basically an "enhanced" version of clojure.core/bound-fn.
raw docstring

$bound-fn*clj

Returns a function which, when called, will install the same dynamic environment active in the thread at the time $bound-fn* was called and then call f with any given arguments.

This is basically an "enhanced" version of clojure.core/bound-fn*.

Returns a function which, when called, will install the same dynamic
environment active in the thread at the time $bound-fn* was called
and then call f with any given arguments.

This is basically an "enhanced" version of clojure.core/bound-fn*.
raw docstring

*allow-recursive-trampolines*clj

Are we allowed to start another trampoline if there's already one on the stack?

Default: true

Are we allowed to start another trampoline if there's already one on the stack?

Default: true
raw docstring

*compiling-cps*clj

Set to true when the CPS compiler expands a macro

Set to true when the CPS compiler expands a macro
raw docstring

*exception-handler*clj


*special-form-handlers*clj

Contains a map specifying how special forms are handled.

We need to treat certain forms as "special". Often, these are Clojure "special forms", but there are other forms we need to treat specially as well — such as 'binding' forms (which Clojure implements as a macro).

This var provides a unified way of detecting these cases and dispatching to an appropriate handler function. It is also dynamic, allowing compilers built on top of the cps compiler to implement their own special forms.

Clojure special forms are handled by mapping its "special symbol" to a handler function. Other forms are handled by mapping the var object representing the operator of the form (i.e., #'binding) to a handler function. The handler function must accept the following parameters (in order)

  • form - the form to be expanded
  • macro-env - the macro environment
  • continuation - a form representing the current continuation of the form being expanded
  • dynamic-env - a symbol representing the dynamic environment that will be available when the form is executed (i.e., a map containing the var->value bindings for dynamic vars)
Contains a map specifying how special forms are handled.

We need to treat certain forms as "special".
Often, these are Clojure "special forms",
but there are other forms we need to treat specially as well —
such as 'binding' forms (which Clojure implements as a macro).

This var provides a unified way of detecting these cases
and dispatching to an appropriate handler function.
It is also dynamic, allowing compilers built on top of the cps compiler
to implement their own special forms.

Clojure special forms are handled by mapping its "special symbol"
to a handler function.
Other forms are handled by mapping the var object
representing the operator of the form (i.e., #'binding)
to a handler function.
The handler function must accept the following parameters (in order)
* form - the form to be expanded
* macro-env - the macro environment
* continuation - a form representing the current continuation
                 of the form being expanded
* dynamic-env - a symbol representing the dynamic environment
                that will be available when the form is executed
                (i.e., a map containing the var->value bindings
                for dynamic vars)
raw docstring

*strict-cps*clj

If true, we are not allowed to make calls to CPS functions. Otherwise, we can mix functions any way we like.

Default: false

If true, we are not allowed to make calls to CPS functions.
Otherwise, we can mix functions any way we like.

Default: false
raw docstring

*trampoline-depth*clj

Records the number of trampolines active on the current stack.

Records the number of trampolines active on the current stack.
raw docstring

auto-override-fncljmacro

(auto-override-fn name)

Attempts to automatically generate a CPS override for a function from its native definition. This requires that the source code be for the function is discoverable. Currently, this is done via clojure.repl/source-fn. If the source for the function can not be located, a compile-time exception is thrown.

name is the name (symbol) of the function to override.

This macro is useful to cases where a) the source code for a function is discoverable, and b) that code can be transformed as-is by the CPS compiler (i.e., it does not contain unsupported forms) If those conditions are satisfied, this macro is a great way to provide a CPS implementation of a function without the need to duplicate the code.

Attempts to automatically generate a CPS override for a function
from its native definition.
This requires that the source code be for the function
is discoverable.
Currently, this is done via clojure.repl/source-fn.
If the source for the function can not be located,
a compile-time exception is thrown.

name is the name (symbol) of the function to override.

This macro is useful to cases where
a) the source code for a function is discoverable, and
b) that code can be transformed as-is by the CPS compiler
   (i.e., it does not contain unsupported forms)
If those conditions are satisfied, this macro is a great way
to provide a CPS implementation of a function
without the need to duplicate the code.
raw docstring

callclj

(call f cont env & args)

call-ccclj


cpscljmacro

(cps & body)

cps-applycljmacro

(cps-apply cont env f evaled unevaled)

Helper macro used by cps-call for transforming function calls.

Parameters: cont - this form's continuation form f - a symbol representing the function to be called evaled - a vector of symbols representing values for function argument expressions that have been transformed so far unevaled - a vector containing forms for function arguments that still need to be transformed

 Helper macro used by cps-call for transforming function calls.

Parameters:
  cont - this form's continuation form
  f - a symbol representing the function to be called
  evaled - a vector of symbols representing values
           for function argument expressions
           that have been transformed so far
  unevaled - a vector containing forms for function arguments
             that still need to be transformed
raw docstring

cps-bindingcljmacro

(cps-binding cont env bindings & body)

cps-callcljmacro

(cps-call cont env)
(cps-call cont env f & args)

Macro that transforms a function call.

Parameters: cont - this form's continuation form f - the form of the function to be called args - the forms of the function arguments

Macro that transforms a function call.

Parameters:
  cont - this form's continuation form
  f - the form of the function to be called
  args - the forms of the function arguments
raw docstring

cps-collcljmacro

(cps-coll cont env coll)

cps-defcljmacro

(cps-def cont env name)
(cps-def cont env name expr)
(cps-def cont env name doc expr)

cps-docljmacro

(cps-do cont env)
(cps-do cont env expr & body)

cps-dotcljmacro

(cps-dot cont env & body)

cps-exprcljmacro

(cps-expr cont env expr)

cps-exprscljmacro

(cps-exprs env exprs callback)

Low-level macro for transforming a sequence of expressions and binding their values to variables.

After all expressions have been processed, callback is called with a collection of symbols which will be bound to the values of the expressions. callback should return a form, which will be executed in a scope with all these variables. Note that callback must be an actual function, callable at macro-expansion time, not a form representing a function.

Low-level macro for transforming a sequence of expressions
and binding their values to variables.

After all expressions have been processed,
callback is called with a collection of symbols
which will be bound to the values of the expressions.
callback should return a form,
which will be executed in a scope with all these variables.
Note that callback must be an actual function,
callable at macro-expansion time,
not a form representing a function.
raw docstring

cps-fncljmacro

(cps-fn & body)

Generates a CPS-transformed function from the given body(ies). Simply specify the function the same way you would use fn.

Generates a CPS-transformed function from the given body(ies).
Simply specify the function the same way you would use fn.
raw docstring

cps-fn*cljmacro

(cps-fn* cont env name & bodies)

Constructs a CPS-transformed function

If cont is not nil, it will be called with the resulting function. Otherwise, the resulting form will evaluate direcly to the function.

Constructs a CPS-transformed function

If cont is not nil, it will be called with the resulting function.
Otherwise, the resulting form will evaluate direcly to the function.
raw docstring

cps-formcljmacro

(cps-form cont env form)

cps-ifcljmacro

(cps-if cont env test then)
(cps-if cont env test then else)

cps-let*cljmacro

(cps-let* cont env bindings & body)

cps-let-cccljmacro

(cps-let-cc cont env [cc] & body)

CPS-aware macro for expanding a let-cc form

CPS-aware macro for expanding a let-cc form
raw docstring

cps-letfn*cljmacro

(cps-letfn* cont env bindings & body)

cps-newcljmacro

(cps-new cont env class & params)

cps-quotecljmacro

(cps-quote cont env & body)

cps-set!cljmacro

(cps-set! cont env place expr)

cps-special-formcljmacro

(cps-special-form cont env form)

cps-symbolcljmacro

(cps-symbol cont env name)

cps-trycljmacro

(cps-try cont env & exprs)

cps-varcljmacro

(cps-var cont env symbol)

default-exception-handlerclj

(default-exception-handler ex)

dynamic?clj

(dynamic? resolved-var)

fn->callableclj

(fn->callable f)

Reifies f to implement both ICallable and IFn. The result is an object that can be called with call -- e.g., within CPS-transformed code -- or directly as an IFn (e.g., in "normal" code). If invoked as an IFn, it will automatically start a trampoline.

f must implement IFn, and must accept a continuation as its first argument. Ideally, it will be CPS-transformed.

Reifies f to implement both ICallable and IFn.
The result is an object that can be called with call --
e.g., within CPS-transformed code --
or directly as an IFn (e.g., in "normal" code).
If invoked as an IFn, it will automatically start a trampoline.

f must implement IFn, and must accept a continuation as its first argument.
Ideally, it will be CPS-transformed.
raw docstring

forbid-fn!clj

(forbid-fn! f)
(forbid-fn! f msg)

Provides a "CPS Override" for a fn that throws an IllegalStateException, thus effectively preventing the function from being called from a CPS context.

Provides a "CPS Override" for a fn that throws an IllegalStateException,
thus effectively preventing the function from being called from a CPS context.
raw docstring

get-dynamic-envclj

(get-dynamic-env)

Returns an opaque representation of the current thread's dynamic bindings

Returns an opaque representation of the current thread's dynamic bindings
raw docstring

handler-casecljmacro

(handler-case protected & exception-handlers)

Executes protected in an environment with the specified exception-handlers installed as exception handlers. If protected exits normally, handler-case returns its value. Otherwise (if protected throws an exception), the first exception-handler that matches the thrown exception type will be invoked. If no matching handler is found, the exception is re-thrown.

exception-handlers => exception-handler*

exception-handler => (exception-type [name] & handler-body)

  • exception-type - Type of exception to be handled by this case. An exception will match this case if it is of this type or a sub-type of this type.
  • name - Name (variable) to which the thrown exception will be bound.
  • handler-body - sequence of expressions to be evaluated when a matching exception is thrown.
Executes protected in an environment with the specified exception-handlers
installed as exception handlers.
If protected exits normally, handler-case returns its value.
Otherwise (if protected throws an exception),
the first exception-handler that matches the thrown exception type
will be invoked.
If no matching handler is found, the exception is re-thrown.

exception-handlers => exception-handler*

exception-handler => (exception-type [name] & handler-body)
* exception-type - Type of exception to be handled by this case.
                   An exception will match this case if it is of this type
                   or a sub-type of this type.
* name - Name (variable) to which the thrown exception will be bound.
* handler-body - sequence of expressions to be evaluated
                 when a matching exception is thrown.
raw docstring

ICallablecljprotocol

with-continuationclj

(with-continuation callable cont env)

IThunkcljprotocol

invoke-thunkclj

(invoke-thunk thunk)

let-cccljmacro

(let-cc [cc] & body)

Executes body with <cc> bound to the current continuation.

Usage:

(let-cc [<cc>]
  <body...>
Executes body with <cc> bound to the current continuation.

Usage:

    (let-cc [<cc>]
      <body...>
raw docstring

override-fncljmacro

(override-fn name & fn-tails)

Used to provide a CPS-transformed version of an existing native function.

This macro generates a CPS override for the specified function from the provided implementation code (in fn-tails). The provided implementation code is CPS-transformed and will be called (as a CPS routine) when the specified function is called from within another CPS routine. This effectively replaces the native implementation with a CPS implementation in such cases.

name is the function to override.

fn-tails are function parameter list(s) and body(ies), as would be used in a fn or cps-fn form. These are enclosed in a cps-fn form and sent through the CPS compiler.

Used to provide a CPS-transformed version of an existing native function.

This macro generates a CPS override for the specified function
from the provided implementation code (in fn-tails).
The provided implementation code is CPS-transformed
and will be called (as a CPS routine) when the specified function is called
from within another CPS routine.
This effectively replaces the native implementation
with a CPS implementation in such cases.

name is the function to override.

fn-tails are function parameter list(s) and body(ies),
as would be used in a fn or cps-fn form.
These are enclosed in a cps-fn form and sent through the CPS compiler.
raw docstring

override-fn*cljmacro

(override-fn* name callable)

Version of override-fn that accepts an ICallable object, rather than a function form.

Version of override-fn that accepts an ICallable object,
rather than a function form.
raw docstring

override-macro!cljmacro

(override-macro! name & fn-spec)

raiseclj


thunkcljmacro

(thunk & body)

trampolineclj

(trampoline f & args)

Runs f on a trampoline, and returns the resulting value.

Runs f on a trampoline, and returns the resulting value.
raw docstring

translate-toclj

(translate-to symbol)

Helper for constructing handler functions for translating forms from one language to another. Basically, the operator of the input form is replaced with the symbol parameter.

Helper for constructing handler functions
for translating forms from one language to another.
Basically, the operator of the input form is replaced
with the symbol parameter.
raw docstring

unwind-protectcljmacro

(unwind-protect protected & cleanup)

with-dynamic-envcljmacro

(with-dynamic-env env & body)

Takes an opague dynamic environment (á la get-dynamic-env). The body is then executed with that environment activated.

Takes an opague dynamic environment (á la get-dynamic-env).
The body is then executed with that environment activated.
raw docstring

with-dynamic-env*clj

(with-dynamic-env* env f & args)

Takes an opaque dynamic environment (á la get-dynamic-env) and a function of no arguments. The function is then called with that environment activated.

Takes an opaque dynamic environment (á la get-dynamic-env)
and a function of no arguments.
The function is then called with that environment activated.
raw docstring

with-exception-handlercljmacro

(with-exception-handler f & body)

Executes body in a context with f effectively installed as an exception handler function.

Executes body in a context with f effectively installed
as an exception handler function.
raw docstring

with-strict-cpscljmacro

(with-strict-cps & body)

with-thread-binding-framecljmacro

(with-thread-binding-frame frame & body)

without-recursive-trampolinescljmacro

(without-recursive-trampolines & body)

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

× close