API for heimdallr - heimdallr ()


Usage:
(ns your-namespace
  (:require heimdallr))

Overview

Small lib for Context-Oriented Programming.

Public Variables and Functions



*context*

var

  
This dynamic var holds the current Context Stack for a thread.
Source


deflayer

macro
Usage: (deflayer sym)
       (deflayer sym requires)
Defines a Layer.
The <requires> param must be a vector of layers that are required for this layer to work.
Source


deflayered

macro
Usage: (deflayered sym & extra)
Defines a layered function. For the base definition, simply don't provide a layer.
For layer-dependant definitions, pass a layer before the args vector and sexps.
An optional doc-string can be provided for the base definition.
Source


layer?

function
Usage: (layer? l)

  
  
  Source


pop-layer

function
Usage: (pop-layer)
Pops the layer at the top of the Context Stack so it can't be used globally by all layered functions.
Returns the popped layer.
Source


proceed

function
Usage: (proceed layer & args)
Given a layer currently on the stack and args for the partial definition, runs the code and returns the result.
Note #1: This fn can only be called inside a layered function.
Note #2: To use the base definition, pass the :default keyword as the layer.
Note #3: If no layer is given and the :default implementation is not requested,
         it will look for the first definition it can find for the layers in the stack
         by searching from the top to the bottom of the stack.
Source


push-layer

function
Usage: (push-layer layer)
Pushes a layer onto the Context Stack to be used globally by all layered functions.
Source


with-context

macro
Usage: (with-context ctx & forms)
Executes the given forms inside the given context.
In order to activate multiple layers at the same time, pass the layers as a vector (example: [layer-1, layer-2, ...])
The latter layers will be nested inside the former ones as in:
(layer-1
  (layer-2
    (layer-3 ...)))
Source
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.