The curry-compose-reader-macros Reference Manual

Table of Contents

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

The curry-compose-reader-macros Reference Manual

This is the curry-compose-reader-macros Reference Manual, version 1.0.0, generated automatically by Declt version 2.4 "Will Decker" on Wed Jun 20 11:39:28 2018 GMT+0.


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

1 Introduction

CURRY-COMPOSE-READER-MACROS

Reader macros for concise expression of function partial application and composition.

These reader macros expand into the curry, rcurry and compose functions from the Alexandria library. The contents of curly brackets are curried and the contents of square brackets are composed. The _ symbol inside curly brackets changes the order of arguments with rcurry.

The following examples demonstrate usage.

;; partial application `curry'
(mapcar {+ 1} '(1 2 3 4)) ; => (2 3 4 5)

;; alternate order of arguments `rcurry'
(mapcar {- _ 1} '(1 2 3 4)) ; => (0 1 2 3)

;; function composition
(mapcar [#'list {* 2}] '(1 2 3 4)) ; => ((2) (4) (6) (8))

Additionally special brackets may be used to split arguments amongst a list of functions and collect the results. The first element of the «»-delimited list is the "join" function. Incoming arguments are split out to the remaining functions in the «»-delimited list, and their results are then passed to the join function.

;; function split and join
(mapcar «list {* 2} {* 3}» '(1 2 3 4)) ; => ((2 3) (4 6) (6 9) (8 12))
(mapcar «and {< 2} #'evenp» '(1 2 3 4)) ; => (NIL NIL NIL T)
(mapcar «+ {* 2} {- _ 1}» '(1 2 3 4)) ; => (2 5 8 11)

Load CURRY-COMPOSE-READER-MACROS at the REPL with the following

(ql:quickload :curry-compose-reader-macros)
(ql:quickload :named-readtables)
(use-package 'named-readtables)
(in-readtable curry-compose-reader-macros:syntax)

Use CURRY-COMPOSE-READER-MACROS in source by adding NAMED-READTABLES and CURRY-COMPOSE-READER-MACROS to your ASDF file and package and then including the following in source files which use these reader macros.

(in-readtable :curry-compose-reader-macros)

Emacs users may easily treat {}'s, []'s and «»'s as parenthesis for paredit commands and SEXP movement with the following configuration.

;; Syntax table
(modify-syntax-entry ?\[ "(]" lisp-mode-syntax-table)
(modify-syntax-entry ?\] ")[" lisp-mode-syntax-table)
(modify-syntax-entry ?\{ "(}" lisp-mode-syntax-table)
(modify-syntax-entry ?\} "){" lisp-mode-syntax-table)
;; optional UTF8 characters
(modify-syntax-entry ?\« "(»" lisp-mode-syntax-table)
(modify-syntax-entry ?\» ")«" lisp-mode-syntax-table)

;; Paredit keys
(eval-after-load "paredit"
  '(progn
    (define-key paredit-mode-map "[" 'paredit-open-parenthesis)
    (define-key paredit-mode-map "]" 'paredit-close-parenthesis)
    (define-key paredit-mode-map "(" 'paredit-open-bracket)
    (define-key paredit-mode-map ")" 'paredit-close-bracket)
    (define-key paredit-mode-map "{" 'paredit-open-curly)
    (define-key paredit-mode-map "}" 'paredit

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 curry-compose-reader-macros

Author

Eric Schulte <schulte.eric@gmail.com>

License

Public Domain

Description

reader macros for concise function partial application and composition

Version

1.0.0

Dependencies
Source

curry-compose-reader-macros.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 curry-compose-reader-macros.asd

Location

curry-compose-reader-macros.asd

Systems

curry-compose-reader-macros (system)


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

3.1.2 curry-compose-reader-macros/package.lisp

Parent

curry-compose-reader-macros (system)

Location

package.lisp

Packages

curry-compose-reader-macros


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

3.1.3 curry-compose-reader-macros/curry-compose-reader-macros.lisp

Dependency

package.lisp (file)

Parent

curry-compose-reader-macros (system)

Location

curry-compose-reader-macros.lisp

Internal Definitions

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

4 Packages

Packages are listed by definition order.


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

4.1 curry-compose-reader-macros

Source

package.lisp (file)

Use List
Internal Definitions

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

5 Definitions

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


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

5.1 Internal definitions


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

5.1.1 Functions

Function: langle-quotation-reader STREAM INCHAR
Package

curry-compose-reader-macros

Source

curry-compose-reader-macros.lisp (file)

Function: lcurly-brace-reader STREAM INCHAR
Package

curry-compose-reader-macros

Source

curry-compose-reader-macros.lisp (file)

Function: lsquare-brace-reader STREAM INCHAR
Package

curry-compose-reader-macros

Source

curry-compose-reader-macros.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
curry-compose-reader-macros.asd: The curry-compose-reader-macros<dot>asd file
curry-compose-reader-macros/curry-compose-reader-macros.lisp: The curry-compose-reader-macros/curry-compose-reader-macros<dot>lisp file
curry-compose-reader-macros/package.lisp: The curry-compose-reader-macros/package<dot>lisp file

F
File, Lisp, curry-compose-reader-macros.asd: The curry-compose-reader-macros<dot>asd file
File, Lisp, curry-compose-reader-macros/curry-compose-reader-macros.lisp: The curry-compose-reader-macros/curry-compose-reader-macros<dot>lisp file
File, Lisp, curry-compose-reader-macros/package.lisp: The curry-compose-reader-macros/package<dot>lisp file

L
Lisp File, curry-compose-reader-macros.asd: The curry-compose-reader-macros<dot>asd file
Lisp File, curry-compose-reader-macros/curry-compose-reader-macros.lisp: The curry-compose-reader-macros/curry-compose-reader-macros<dot>lisp file
Lisp File, curry-compose-reader-macros/package.lisp: The curry-compose-reader-macros/package<dot>lisp file

Jump to:   C   F   L  

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

A.2 Functions

Jump to:   F   L  
Index Entry  Section

F
Function, langle-quotation-reader: Internal functions
Function, lcurly-brace-reader: Internal functions
Function, lsquare-brace-reader: Internal functions

L
langle-quotation-reader: Internal functions
lcurly-brace-reader: Internal functions
lsquare-brace-reader: Internal functions

Jump to:   F   L  

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
curry-compose-reader-macros: The curry-compose-reader-macros system
curry-compose-reader-macros: The curry-compose-reader-macros package

P
Package, curry-compose-reader-macros: The curry-compose-reader-macros package

S
System, curry-compose-reader-macros: The curry-compose-reader-macros system

Jump to:   C   P   S