The binding-arrows Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The binding-arrows Reference Manual

This is the binding-arrows Reference Manual, version 1.0.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed Jun 15 03:18:48 2022 GMT+0.

Table of Contents


1 Introduction

Binding Arrows

An implementation of threading macros based on binding anonymous variables.

Overview

This system implements binding threading macros - a kind of threading macros with different semantics than classical, Clojure core threading macros or their extension, swiss-arrows. Two Common Lisp implementations of those are arrows and arrow-macros.

This system is a fork of arrows with changes in semantics that make it impossible to merge back upstream.

What's the difference?

A binding threading macro implicitly binds a variable on each computation step, as opposed to working purely on the syntactic level like the classical threading macros.

This has three main implications:

Contents

This system contains a package binding-macros that exports the following symbols:

All of the aforementioned threading macros name valid places for use in setf.

Loading

(ql:quickload :binding-arrows)

Testing

(asdf:test-system :binding-arrows)

Manual pages

License

MIT.


2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 binding-arrows

An implementation of threading macros based on binding anonymous variables

Author

Michał "phoe" Herda <phoe@disroot.org>

License

MIT

Version

1.0.0

Source

binding-arrows.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


3.1.1 binding-arrows/binding-arrows.asd

Source

binding-arrows.asd.

Parent Component

binding-arrows (system).

ASDF Systems

binding-arrows.


3.1.2 binding-arrows/binding-arrows.lisp

Source

binding-arrows.asd.

Parent Component

binding-arrows (system).

Packages

binding-arrows.

Public Interface
Internals

3.1.3 binding-arrows/documentation.lisp

Source

binding-arrows.asd.

Parent Component

binding-arrows (system).


4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 binding-arrows

Source

binding-arrows.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


5.1.1 Macros

Macro: -<> (&body forms)

The diamond wand threading macro.

Binds anonymous variables and threads them into subsequent forms:
* by substituting diamond symbols (<>) if they are present in the form, * as their first arguments (like the -> macro) otherwise.

The diamond symbols are tested by name, not by identity, like LOOP keywords.

The diamond wand does not descend into subforms in its search for diamonds; see the ARROW-MACROS system for an implementation that performs code walking.

For example, the following form:

(-<> foo
bar
(baz)
(quux 1 2 3)
(fred 4 5 6 <>)
(frob 7 <> 8 <> 9))

Is equivalent to:

(let ((temp1 foo)
(temp2 (bar temp1))
(temp3 (baz temp2))
(temp4 (quux temp3 1 2 3))
(temp5 (fred 4 5 6 temp4))
(temp6 (quux 7 temp5 8 temp5 9)))
temp6)

Package

binding-arrows.

Source

binding-arrows.lisp.

Setf expander for this macro

(setf -<>).

Macro: -<>> (&body forms)

The diamond spear threading macro.

Binds anonymous variables and threads them into subsequent forms:
* by substituting diamond symbols (<>) if they are present in the form, * as their last arguments (like the ->> macro) otherwise.

The diamond symbols are tested by name, not by identity, like LOOP keywords.

The diamond wand does not descend into subforms in its search for diamonds; see the ARROW-MACROS system for an implementation that performs code walking.

For example, the following form:

(-<>> foo
bar
(baz)
(quux 1 2 3)
(fred 4 5 6 <>)
(frob 7 <> 8 <> 9))

Is equivalent to:

(let ((temp1 foo)
(temp2 (bar temp1))
(temp3 (baz temp2))
(temp4 (quux 1 2 3 temp3))
(temp5 (fred 4 5 6 temp4))
(temp6 (quux 7 temp5 8 temp5 9)))
temp6)

Package

binding-arrows.

Source

binding-arrows.lisp.

Setf expander for this macro

(setf -<>>).

Macro: -> (&body forms)

The thread-first threading macro.

Binds anonymous variables and threads them into subsequent forms as their first arguments.

For example, the following form:

(-> foo
bar
(baz)
(quux 1 2 3))

Is equivalent to:

(let ((temp1 foo)
(temp2 (bar temp1))
(temp3 (baz temp2))
(temp4 (quux temp3 1 2 3)))
temp4)

Package

binding-arrows.

Source

binding-arrows.lisp.

Setf expander for this macro

(setf ->).

Macro: ->* (&body forms)

The inverted thread-first threading macro.

Binds anonymous variables and threads them into subsequent forms as their first arguments. The order of the forms is altered, so that the last form is used as the initialization form.

For example, the following form:

(->* bar
(baz)
(quux 1 2 3)
foo)

Is equivalent to:

(-> foo
bar
(baz)
(quux 1 2 3))

And therefore to:

(let ((temp1 foo)
(temp2 (bar temp1))
(temp3 (baz temp2))
(temp4 (quux temp3 1 2 3)))
temp4)

Package

binding-arrows.

Source

binding-arrows.lisp.

Setf expander for this macro

(setf ->*).

Macro: ->> (&body forms)

The thread-last threading macro.

Binds anonymous variables and threads them into subsequent forms as their last arguments.

For example, the following form:

(->> foo
bar
(baz)
(quux 1 2 3))

Is equivalent to:

(let ((temp1 foo)
(temp2 (bar temp1))
(temp3 (baz temp2))
(temp4 (quux 1 2 3 temp3)))
temp4)

Package

binding-arrows.

Source

binding-arrows.lisp.

Setf expander for this macro

(setf ->>).

Macro: as-> (initial-form var &body forms)

The named threading macro.

Binds the provided variable to subsequent forms, which may make use of the bound variable.

For example, the following form:

(as-> foo var
(bar var)
(baz var)
(quux 1 2 3))

Is equivalent to:

(let* ((var foo)
(var (bar var))
(var (baz var))
(var (quux 1 2 3)))
var)

Package

binding-arrows.

Source

binding-arrows.lisp.

Setf expander for this macro

(setf as->).

Macro: as->* (var &body forms)

The inverted named threading macro.

Binds the provided variable to subsequent forms, which may make use of the bound variable. The order of the forms is altered, so that the last form is used as the initialization form for the variable.

For example, the following form:

(as->* var
(bar var)
(baz var)
(quux 1 2 3)
foo)

Is equivalent to:

(as-> foo var
(bar var)
(baz var)
(quux 1 2 3))

And therefore to:

(let* ((var foo)
(var (bar var))
(var (baz var))
(var (quux 1 2 3)))
var)

Package

binding-arrows.

Source

binding-arrows.lisp.

Setf expander for this macro

(setf as->*).

Macro: cond-<> (&body forms)

The short-cicruiting diamond thread-first threading macro.

Binds anonymous variables and threads them into subsequent forms:
* by substituting diamond symbols (<>) if they are present in the form, * as their first arguments (like the -> macro) otherwise.

The binding is only effective when the test of a given form returns true.

If any form returns NIL, the subsequent forms are not evaluated, and NIL is returned.

For example, the following form:

(cond-<> foo
(barp x y z)
(bazp (baz))
((quuxp thing) (quux 1 <> 2 3)))

Is equivalent to:

(let* ((temp1 foo)
(temp2 (if barp
(-<> temp1 x y z)
temp1))
(temp3 (if bazp
(-<> temp2 (baz))
temp2))
(temp4 (if (quuxp thing)
(-<> temp3 (quux 1 <> 2 3)) temp3)))
temp4)

Package

binding-arrows.

Source

binding-arrows.lisp.

Setf expander for this macro

(setf cond-<>).

Macro: cond-<>> (&body forms)

The short-cicruiting diamond thread-last threading macro.

Binds anonymous variables and threads them into subsequent forms:
* by substituting diamond symbols (<>) if they are present in the form, * as their last arguments (like the ->> macro) otherwise.

The binding is only effective when the test of a given form returns true.

If any form returns NIL, the subsequent forms are not evaluated, and NIL is returned.

For example, the following form:

(cond-<>> foo
(barp x y z)
(bazp (baz))
((quuxp thing) (quux 1 <> 2 3)))

Is equivalent to:

(let* ((temp1 foo)
(temp2 (if barp
(-<>> temp1 x y z)
temp1))
(temp3 (if bazp
(-<>> temp2 (baz))
temp2))
(temp4 (if (quuxp thing)
(-<>> temp3 (quux 1 <> 2 3)) temp3)))
temp4)

Package

binding-arrows.

Source

binding-arrows.lisp.

Setf expander for this macro

(setf cond-<>>).

Macro: cond-> (&body forms)

The conditional thread-first threading macro.

Binds anonymous variables and threads them into the subsequent forms as their first arguments, but only when the test of a given form returns true.

For example, the following form:

(cond-> foo
(barp x y z)
(bazp (baz))
((quuxp thing) (quux 1 2 3)))

Is equivalent to:

(let* ((temp1 foo)
(temp2 (if barp
(-> temp1 x y z)
temp1))
(temp3 (if bazp
(-> temp2 (baz))
temp2))
(temp4 (if (quuxp thing)
(-> temp3 (quux 1 2 3))
temp3)))
temp4)

Package

binding-arrows.

Source

binding-arrows.lisp.

Setf expander for this macro

(setf cond->).

Macro: cond->> (&body forms)

The conditional thread-last threading macro.

Binds anonymous variables and threads them into the subsequent forms as their last arguments, but only when the test of a given form returns true.

For example, the following form:

(cond->> foo
(barp x y z)
(bazp (baz))
((quuxp thing) (quux 1 2 3)))

Is equivalent to:

(let* ((temp1 foo)
(temp2 (if barp
(->> temp1 x y z)
temp1))
(temp3 (if bazp
(->> temp2 (baz))
temp2))
(temp4 (if (quuxp thing)
(->> temp3 (quux 1 2 3))
temp3)))
temp4)

Package

binding-arrows.

Source

binding-arrows.lisp.

Setf expander for this macro

(setf cond->>).

Macro: some-<> (&body forms)

The short-cicruiting diamond thread-first threading macro.

Binds anonymous variables and threads them into subsequent forms:
* by substituting diamond symbols (<>) if they are present in the form, * as their first arguments (like the -> macro) otherwise.

If any form returns NIL, the subsequent forms are not evaluated, and NIL is returned.

For example, the following form:

(some-<> foo
bar
(baz :baz)
(quux 1 <> 2 3))

Is equivalent to:

(let ((temp1 foo)
(temp2 (and temp1 (bar temp1)))
(temp3 (and temp2 (baz temp2 :baz)))
(temp4 (and temp3 (quux 1 temp3 2 3))))
temp4)

Package

binding-arrows.

Source

binding-arrows.lisp.

Setf expander for this macro

(setf some-<>).

Macro: some-<>> (&body forms)

The short-cicruiting diamond thread-first threading macro.

Binds anonymous variables and threads them into subsequent forms:
* by substituting diamond symbols (<>) if they are present in the form, * as their last arguments (like the ->> macro) otherwise.

If any form returns NIL, the subsequent forms are not evaluated, and NIL is returned.

For example, the following form:

(some-<>> foo
bar
(baz :baz)
(quux 1 <> 2 3))

Is equivalent to:

(let ((temp1 foo)
(temp2 (and temp1 (bar temp1)))
(temp3 (and temp2 (baz :baz temp2)))
(temp4 (and temp3 (quux 1 temp3 2 3))))
temp4)

Package

binding-arrows.

Source

binding-arrows.lisp.

Setf expander for this macro

(setf some-<>>).

Macro: some-> (&body forms)

The short-cicruiting thread-first threading macro.

Binds anonymous variables and threads them into subsequent forms as their first arguments. If any form returns NIL, the subsequent forms are not evaluated, and NIL is returned.

For example, the following form:

(some-> foo
bar
(baz)
(quux 1 2 3))

Is equivalent to:

(let ((temp1 foo)
(temp2 (and temp1 (bar temp1)))
(temp3 (and temp2 (baz temp2)))
(temp4 (and temp3 (quux temp3 1 2 3))))
temp4)

Package

binding-arrows.

Source

binding-arrows.lisp.

Setf expander for this macro

(setf some->).

Macro: some->> (&body forms)

The short-cicruiting thread-last threading macro.

Binds anonymous variables and threads them into subsequent forms as their last arguments. If any form returns NIL, the subsequent forms are not evaluated, and NIL is returned.

For example, the following form:

(some->> foo
bar
(baz)
(quux 1 2 3))

Is equivalent to:

(let ((temp1 foo)
(temp2 (and temp1 (bar temp1)))
(temp3 (and temp2 (baz temp2)))
(temp4 (and temp3 (quux 1 2 3 temp3))))
temp4)

Package

binding-arrows.

Source

binding-arrows.lisp.

Setf expander for this macro

(setf some->>).


Previous: , Up: Public Interface   [Contents][Index]

5.1.2 Setf expanders

Setf Expander: (setf -<>) (&body forms)
Package

binding-arrows.

Source

binding-arrows.lisp.

Reader

-<> (macro).

Setf Expander: (setf -<>>) (&body forms)
Package

binding-arrows.

Source

binding-arrows.lisp.

Reader

-<>> (macro).

Setf Expander: (setf ->) (&body forms)
Package

binding-arrows.

Source

binding-arrows.lisp.

Reader

-> (macro).

Setf Expander: (setf ->*) (&body forms)
Package

binding-arrows.

Source

binding-arrows.lisp.

Reader

->* (macro).

Setf Expander: (setf ->>) (&body forms)
Package

binding-arrows.

Source

binding-arrows.lisp.

Reader

->> (macro).

Setf Expander: (setf as->) (initial-form var &body forms)
Package

binding-arrows.

Source

binding-arrows.lisp.

Reader

as-> (macro).

Setf Expander: (setf as->*) (var &body forms)
Package

binding-arrows.

Source

binding-arrows.lisp.

Reader

as->* (macro).

Setf Expander: (setf cond-<>) (&body forms)
Package

binding-arrows.

Source

binding-arrows.lisp.

Reader

cond-<> (macro).

Setf Expander: (setf cond-<>>) (&body forms)
Package

binding-arrows.

Source

binding-arrows.lisp.

Reader

cond-<>> (macro).

Setf Expander: (setf cond->) (&body forms)
Package

binding-arrows.

Source

binding-arrows.lisp.

Reader

cond-> (macro).

Setf Expander: (setf cond->>) (&body forms)
Package

binding-arrows.

Source

binding-arrows.lisp.

Reader

cond->> (macro).

Setf Expander: (setf some-<>) (&body forms)
Package

binding-arrows.

Source

binding-arrows.lisp.

Reader

some-<> (macro).

Setf Expander: (setf some-<>>) (&body forms)
Package

binding-arrows.

Source

binding-arrows.lisp.

Reader

some-<>> (macro).

Setf Expander: (setf some->) (&body forms)
Package

binding-arrows.

Source

binding-arrows.lisp.

Reader

some-> (macro).

Setf Expander: (setf some->>) (&body forms)
Package

binding-arrows.

Source

binding-arrows.lisp.

Reader

some->> (macro).


5.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.1 Special variables

Special Variable: *valid-cl-place-forms*
Package

binding-arrows.

Source

binding-arrows.lisp.


5.2.2 Macros

Macro: define-arrow (name lambda-list &body body)
Package

binding-arrows.

Source

binding-arrows.lisp.


Previous: , Up: Internals   [Contents][Index]

5.2.3 Ordinary functions

Function: as-value (symbol form)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: cond-diamond-value-first (symbol form)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: cond-diamond-value-last (symbol form)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: cond-generate-access-fn (symbols expansions)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: cond-generate-store-fn (store symbols value-forms expansions)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: cond-setf-expansions (value-forms env)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: cond-value (arrow symbol form)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: cond-value-first (symbol form)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: cond-value-last (symbol form)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: diamond-value (value-fn symbol form)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: diamond-value-first (symbol form)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: diamond-value-last (symbol form)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: ensure-cons (thing)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: expand-arrow (forms &key symbol-fn value-fn return-fn)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: expand-arrow-return (symbols value-forms env)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: expand-arrow-setf (forms env &key symbol-fn value-fn return-fn)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: expand-arrow-setf-cond-return (symbols value-forms env)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: expand-arrow-setf-return (symbols value-forms env)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: expand-arrow-setf-some-return (symbols value-forms env)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: expand-aux (forms symbol-fn value-fn return-fn &optional env)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: invalid-place-p (form first-value-p)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: make-value-form (value-fn prev-symbol form)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: some-diamond-value-first (symbol form)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: some-diamond-value-last (symbol form)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: some-value (value-fn symbol form)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: some-value-first (symbol form)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: some-value-last (symbol form)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: value-first (symbol form)
Package

binding-arrows.

Source

binding-arrows.lisp.

Function: value-last (symbol form)
Package

binding-arrows.

Source

binding-arrows.lisp.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   (   -  
A   C   D   E   F   I   M   S   V  
Index Entry  Section

(
(setf -<>): Public setf expanders
(setf -<>>): Public setf expanders
(setf ->): Public setf expanders
(setf ->*): Public setf expanders
(setf ->>): Public setf expanders
(setf as->): Public setf expanders
(setf as->*): Public setf expanders
(setf cond-<>): Public setf expanders
(setf cond-<>>): Public setf expanders
(setf cond->): Public setf expanders
(setf cond->>): Public setf expanders
(setf some-<>): Public setf expanders
(setf some-<>>): Public setf expanders
(setf some->): Public setf expanders
(setf some->>): Public setf expanders

-
-<>: Public macros
-<>>: Public macros
->: Public macros
->*: Public macros
->>: Public macros

A
as->: Public macros
as->*: Public macros
as-value: Private ordinary functions

C
cond-<>: Public macros
cond-<>>: Public macros
cond->: Public macros
cond->>: Public macros
cond-diamond-value-first: Private ordinary functions
cond-diamond-value-last: Private ordinary functions
cond-generate-access-fn: Private ordinary functions
cond-generate-store-fn: Private ordinary functions
cond-setf-expansions: Private ordinary functions
cond-value: Private ordinary functions
cond-value-first: Private ordinary functions
cond-value-last: Private ordinary functions

D
define-arrow: Private macros
diamond-value: Private ordinary functions
diamond-value-first: Private ordinary functions
diamond-value-last: Private ordinary functions

E
ensure-cons: Private ordinary functions
expand-arrow: Private ordinary functions
expand-arrow-return: Private ordinary functions
expand-arrow-setf: Private ordinary functions
expand-arrow-setf-cond-return: Private ordinary functions
expand-arrow-setf-return: Private ordinary functions
expand-arrow-setf-some-return: Private ordinary functions
expand-aux: Private ordinary functions

F
Function, as-value: Private ordinary functions
Function, cond-diamond-value-first: Private ordinary functions
Function, cond-diamond-value-last: Private ordinary functions
Function, cond-generate-access-fn: Private ordinary functions
Function, cond-generate-store-fn: Private ordinary functions
Function, cond-setf-expansions: Private ordinary functions
Function, cond-value: Private ordinary functions
Function, cond-value-first: Private ordinary functions
Function, cond-value-last: Private ordinary functions
Function, diamond-value: Private ordinary functions
Function, diamond-value-first: Private ordinary functions
Function, diamond-value-last: Private ordinary functions
Function, ensure-cons: Private ordinary functions
Function, expand-arrow: Private ordinary functions
Function, expand-arrow-return: Private ordinary functions
Function, expand-arrow-setf: Private ordinary functions
Function, expand-arrow-setf-cond-return: Private ordinary functions
Function, expand-arrow-setf-return: Private ordinary functions
Function, expand-arrow-setf-some-return: Private ordinary functions
Function, expand-aux: Private ordinary functions
Function, invalid-place-p: Private ordinary functions
Function, make-value-form: Private ordinary functions
Function, some-diamond-value-first: Private ordinary functions
Function, some-diamond-value-last: Private ordinary functions
Function, some-value: Private ordinary functions
Function, some-value-first: Private ordinary functions
Function, some-value-last: Private ordinary functions
Function, value-first: Private ordinary functions
Function, value-last: Private ordinary functions

I
invalid-place-p: Private ordinary functions

M
Macro, -<>: Public macros
Macro, -<>>: Public macros
Macro, ->: Public macros
Macro, ->*: Public macros
Macro, ->>: Public macros
Macro, as->: Public macros
Macro, as->*: Public macros
Macro, cond-<>: Public macros
Macro, cond-<>>: Public macros
Macro, cond->: Public macros
Macro, cond->>: Public macros
Macro, define-arrow: Private macros
Macro, some-<>: Public macros
Macro, some-<>>: Public macros
Macro, some->: Public macros
Macro, some->>: Public macros
make-value-form: Private ordinary functions

S
Setf Expander, (setf -<>): Public setf expanders
Setf Expander, (setf -<>>): Public setf expanders
Setf Expander, (setf ->): Public setf expanders
Setf Expander, (setf ->*): Public setf expanders
Setf Expander, (setf ->>): Public setf expanders
Setf Expander, (setf as->): Public setf expanders
Setf Expander, (setf as->*): Public setf expanders
Setf Expander, (setf cond-<>): Public setf expanders
Setf Expander, (setf cond-<>>): Public setf expanders
Setf Expander, (setf cond->): Public setf expanders
Setf Expander, (setf cond->>): Public setf expanders
Setf Expander, (setf some-<>): Public setf expanders
Setf Expander, (setf some-<>>): Public setf expanders
Setf Expander, (setf some->): Public setf expanders
Setf Expander, (setf some->>): Public setf expanders
some-<>: Public macros
some-<>>: Public macros
some->: Public macros
some->>: Public macros
some-diamond-value-first: Private ordinary functions
some-diamond-value-last: Private ordinary functions
some-value: Private ordinary functions
some-value-first: Private ordinary functions
some-value-last: Private ordinary functions

V
value-first: Private ordinary functions
value-last: Private ordinary functions

Jump to:   (   -  
A   C   D   E   F   I   M   S   V  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*valid-cl-place-forms*: Private special variables

S
Special Variable, *valid-cl-place-forms*: Private special variables

Jump to:   *  
S