The cl-arrows Reference Manual

Table of Contents

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

The cl-arrows Reference Manual

This is the cl-arrows Reference Manual, version 0.0.1, generated automatically by Declt version 2.3 "Robert April" on Wed Mar 14 03:07:34 2018 GMT+0.


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

1 Introduction

CL-Arrows

Implements the -> and ->> threading macros in Clojure, as well as -<> and -<>> from the swiss-arrows library.

This is an ASDF system providing the package cl-arrows.

Documentation

[macro]
-> initial-form &rest forms => results

Inserts INITIAL-FORM as first argument into the first of FORMS, the result into the next, etc., before evaluation. FORMS are treated as list designators.

[macro]
->> initial-form &rest forms => results

Like ->, but the forms are inserted as last argument instead of first.

[macro]
-<> initial-form &rest forms => results

Like ->, but if a form in FORMS has one or more symbols named <> as top-level element, each such symbol is substituted by the primary result of the form accumulated so far, instead of it being inserted as first argument. Also known as diamond wand.

[macro]
-<>> initial-form &rest forms => results

Like -<>, but if a form in FORMS has no symbols named <> as top-level element, insertion is done like in ->>. Also known as diamond spear.

Examples

(-> 3
    /)  ; insert into designated list (/)
=> 1/3

(-> 3
    (expt 2))  ; insert as first argument
=> 9

(->> 3
     (expt 2))  ; insert as last argument
=> 8

(-<>> (list 1 2 3)
      (remove-if #'oddp <> :count 1 :from-end t) ; substitute <>
      (reduce #'+)                               ; insert last
      /)                                         ; list designator
=> 1/3

(let ((x 3))
  (-<> (incf x)     ; (let ((r (incf x)))
       (+ <> <>)))  ;   (+ r r))
=> 8

Todo

Future versions might include further ideas from rplevy's swiss-arrows.


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

2 Systems

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


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

2.1 cl-arrows

Author

Sage Imel

Description

Implements the -> and ->> from clojure, and -<> and -<>> from swiss-arrows.

Version

0.0.1

Source

cl-arrows.asd (file)

Components

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

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


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 cl-arrows.asd

Location

cl-arrows.asd

Systems

cl-arrows (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 cl-arrows/packages.lisp

Parent

cl-arrows (system)

Location

packages.lisp

Packages

cl-arrows


Previous: , Up: Lisp files   [Contents][Index]

3.1.3 cl-arrows/arrows.lisp

Dependency

packages.lisp (file)

Parent

cl-arrows (system)

Location

arrows.lisp

Exported Definitions
Internal Definitions

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

4 Packages

Packages are listed by definition order.


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

4.1 cl-arrows

Source

packages.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

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

5 Definitions

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


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

5.1 Exported definitions


Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Macros

Macro: -<> INITIAL-FORM &rest FORMS

Like ->, but if a form in FORMS has one or more symbols named <> as top-level element, each such symbol is substituted by the primary result of the form accumulated so far, instead of it being inserted as first argument. Also known as diamond wand.

Package

cl-arrows

Source

arrows.lisp (file)

Macro: -<>> INITIAL-FORM &rest FORMS

Like -<>, but if a form has no symbol named <>, the insertion is done at the end like in ->>. Also known as diamond spear.

Package

cl-arrows

Source

arrows.lisp (file)

Macro: -> INITIAL-FORM &rest FORMS

Inserts INITIAL-FORM as first argument into the first of FORMS, the result into the next, etc., before evaluation. FORMS are treated as list designators.

Package

cl-arrows

Source

arrows.lisp (file)

Macro: ->> INITIAL-FORM &rest FORMS

Like ->, but the forms are inserted as last argument instead of first.

Package

cl-arrows

Source

arrows.lisp (file)


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

5.2 Internal definitions


Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Functions

Function: <>p FORM

Predicate identifying the placeholders for the -<> and -<>> macros.

Package

cl-arrows

Source

arrows.lisp (file)

Function: diamond-inserter INSERT-FUN
Package

cl-arrows

Source

arrows.lisp (file)

Function: insert-first ARG SURROUND

Inserts ARG into the list form SURROUND as its first argument, after the operator.

Package

cl-arrows

Source

arrows.lisp (file)

Function: insert-last ARG SURROUND

Inserts ARG into the list form SURROUND as its last argument.

Package

cl-arrows

Source

arrows.lisp (file)

Function: simple-inserter INSERT-FUN
Package

cl-arrows

Source

arrows.lisp (file)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   C   F   L  
Index Entry  Section

C
cl-arrows.asd: The cl-arrows<dot>asd file
cl-arrows/arrows.lisp: The cl-arrows/arrows<dot>lisp file
cl-arrows/packages.lisp: The cl-arrows/packages<dot>lisp file

F
File, Lisp, cl-arrows.asd: The cl-arrows<dot>asd file
File, Lisp, cl-arrows/arrows.lisp: The cl-arrows/arrows<dot>lisp file
File, Lisp, cl-arrows/packages.lisp: The cl-arrows/packages<dot>lisp file

L
Lisp File, cl-arrows.asd: The cl-arrows<dot>asd file
Lisp File, cl-arrows/arrows.lisp: The cl-arrows/arrows<dot>lisp file
Lisp File, cl-arrows/packages.lisp: The cl-arrows/packages<dot>lisp file

Jump to:   C   F   L  

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

A.2 Functions

Jump to:   -   <  
D   F   I   M   S  
Index Entry  Section

-
-<>: Exported macros
-<>>: Exported macros
->: Exported macros
->>: Exported macros

<
<>p: Internal functions

D
diamond-inserter: Internal functions

F
Function, <>p: Internal functions
Function, diamond-inserter: Internal functions
Function, insert-first: Internal functions
Function, insert-last: Internal functions
Function, simple-inserter: Internal functions

I
insert-first: Internal functions
insert-last: Internal functions

M
Macro, -<>: Exported macros
Macro, -<>>: Exported macros
Macro, ->: Exported macros
Macro, ->>: Exported macros

S
simple-inserter: Internal functions

Jump to:   -   <  
D   F   I   M   S  

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

A.3 Variables


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

A.4 Data types

Jump to:   C   P   S  
Index Entry  Section

C
cl-arrows: The cl-arrows system
cl-arrows: The cl-arrows package

P
Package, cl-arrows: The cl-arrows package

S
System, cl-arrows: The cl-arrows system

Jump to:   C   P   S