Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the curly Reference Manual, version 0.1, generated automatically by Declt version 3.0 "Montgomery Scott" on Tue Dec 22 13:13:05 2020 GMT+0.
• Introduction | What curly is all about | |
• Systems | The systems documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
-*- org -*- #+TITLE: Curly #+AUTHOR: Maciej Pasternacki #+EMAIL: maciej@pasternacki.net #+TEXT: Common Lisp reader macros for easy function currying and composition. #+OPTIONS: *:nil * Description Curly is set of two reader macros for easy function currying and composition. It was inspired by [[http://www.paulgraham.com/arc.html][Arc]]'s syntax for currying, using square brackets. Curly creates anonymous functions (lambdas) with literal function composition instead of trying smarter approach (like using (REDUCE #'FUNCALL ...)) so that the compiler is able to do more optimizations. ASDF system definition is included in curly.asd file. Latest version of Curly can be obtained on its GitHub page: https://github.com/mpasternacki/curly ** Square bracket macro Square bracket macro does simple currying: :CURLY> '[foo] :(LAMBDA (#:G2705) (FOO #:G2705)) :CURLY> '[foo bar] :(LAMBDA (#:G2706) (FOO BAR #:G2706)) :CURLY> '[foo bar baz] :(LAMBDA (#:G2707) (FOO BAR BAZ #:G2707)) By using symbol configured by CURLY:*BLANK-ARGUMENT* user can put anonymous function's parameter in desired place, not necessarily at end of argument list. By default, blank argument is a single star, but it can be set e.g. to underscore to better match Arc: :CURLY> '[foo bar * baz] :(LAMBDA (#:G2709) (FOO BAR #:G2709 BAZ)) :CURLY> '[foo * bar baz] :(LAMBDA (#:G2710) (FOO #:G2710 BAR BAZ)) Curly interpretes blank argument only in argument position; blank argument in functional position is left untouched: :CURLY> '[* foo bar baz] :(LAMBDA (#:G2711) (* FOO BAR BAZ #:G2711)) :CURLY> '[* foo * baz] :(LAMBDA (#:G2712) (* FOO #:G2712 BAZ)) ** Curly bracket macro Curly bracket does function composition, which may be coupled with currying. Let's start from simple composition: :CURLY> '{foo bar} :(LAMBDA (#:G2714) (FOO (BAR #:G2714))) :CURLY> '{foo bar baz} :(LAMBDA (#:G2715) (FOO (BAR (BAZ #:G2715)))) :CURLY> '{foo bar baz quux} :(LAMBDA (#:G2716) (FOO (BAR (BAZ (QUUX #:G2716))))) And so on, and so on. When instead of a function name there is a list within the braces, this means currying: :CURLY> '{foo (bar 23) baz quux} :(LAMBDA (#:G2721) (FOO (BAR 23 (BAZ (QUUX #:G2721))))) :CURLY> '{foo (bar 16) (baz 23 42) quux} :(LAMBDA (#:G2723) (FOO (BAR 16 (BAZ 23 42 (QUUX #:G2723))))) Of course, when currying within braces, blank argument can be used as well: :CURLY> '{foo (bar 16) (baz 23 * 42) quux} :(LAMBDA (#:G2724) (FOO (BAR 16 (BAZ 23 (QUUX #:G2724) 42)))) :CURLY> '{foo (bar 16) (baz * 23 42) quux} :(LAMBDA (#:G2725) (FOO (BAR 16 (BAZ (QUUX #:G2725) 23 42))) * Reference All Curly functions, macros and variables are exported from package CURLY. ** *BLANK-ARGUMENT* Variable: specifies symbol that is used to indicate blank argument for currying. Default value is '*. ** CURLY-READER stream character Function: reader macro function for curly braces (composition). ** SQUARE-READER stream character Function: reader macro function for square braces (currying). ** MAKE-CURLY-READTABLE &optional (original-readtable *readtable*) Function: returns modified copy of ORIGINAL-READTABLE that has Curly reader macros turned on. ** ENABLE-CURLY-SYNTAX Macro: enable curly syntax for current file. ** DISABLE-CURLY-SYNTAX Macro: disable curly syntax for current file. Warning: Calling DISABLE-CURLY-SYNTAX when curly syntax is not enabled can give funny results. Also, reading multiple files using ENABLE-CURLY-SYNTAX and DISABLE-CURLY-SYNTAX in different threads can invoke a disaster. ENABLE-CURLY-SYNTAX itself is safe. * Testing Unit tests are included in tests.lisp file. To run test, you need FiveAM testing framework along with required Arnesi library from [[http://common-lisp.net/project/bese/]]. To run the tests, simply load curly with ASDF, and then type into REPL: : (asdf:operate 'asdf:test-op :curly)
Next: Files, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The curly system |
Maciej Pasternacki <maciekp@japhy.fnord.org>
BSD sans advertising clause (see file COPYING for details)
Reader macros for easy function currying and composition.
0.1
curly.asd (file)
curly.lisp (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
• The curly.asd file | ||
• The curly/curly.lisp file |
Next: The curly/curly․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
curly.asd
curly (system)
Previous: The curly․asd file, Up: Lisp files [Contents][Index]
curly (system)
curly.lisp
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The curly.system package | ||
• The curly package |
Next: The curly package, Previous: Packages, Up: Packages [Contents][Index]
curly.asd
Previous: The curly․system package, Up: Packages [Contents][Index]
curly.lisp (file)
common-lisp
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported special variables | ||
• Exported macros | ||
• Exported functions |
Next: Exported macros, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
Symbol used to indicate argument place in curly syntax.
curly.lisp (file)
Next: Exported functions, Previous: Exported special variables, Up: Exported definitions [Contents][Index]
Disable curly syntax for current file.
Warning: Calling DISABLE-CURLY-SYNTAX when curly syntax is not enabled can give funny results. Also, reading multiple files using ENABLE-CURLY-SYNTAX and DISABLE-CURLY-SYNTAX in different threads can invoke a disaster. ENABLE-CURLY-SYNTAX itself is safe.
curly.lisp (file)
Enable curly syntax for current file.
curly.lisp (file)
Previous: Exported macros, Up: Exported definitions [Contents][Index]
Reader macro for #{ character.
curly.lisp (file)
Return new readtable with curly syntax enabled.
curly.lisp (file)
Reader macro for #[ character.
curly.lisp (file)
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal special variables | ||
• Internal functions |
Next: Internal functions, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
Original readtable to restore, used by ENABLE/DISABLE-CURLY-SYNTAX.
curly.lisp (file)
Previous: Internal special variables, Up: Internal definitions [Contents][Index]
curly.lisp (file)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | C F L |
---|
Jump to: | C F L |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | C D E F M S |
---|
Jump to: | C D E F M S |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Jump to: | *
S |
---|
Jump to: | *
S |
---|
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | C P S |
---|
Jump to: | C P S |
---|