Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the cl-anonfun Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 03:27:45 2022 GMT+0.
Next: Systems, Previous: The cl-anonfun Reference Manual, Up: The cl-anonfun Reference Manual [Contents][Index]
cl-anonfun is a Common Lisp library that provides a simple anonymous function notation.
fn form => lambda-form
fn
macro returns lambda
form of anonymous function form
. If special symbols starting with %
are found in form
, its symbols will be placed to lambda-list of lambda
form. Special symbol %
represents its first argument. Special symbol formed %<n>
represents its n
'th argument. Special symbol %&
represents its rest of arguments.
(macroexpand '(fn (* % %)))
; => #'(LAMBDA (%) (* % %))
(funcall (fn (* % %)) 3)
; => 9
(macroexpand '(fn (mapcar %2 %1)))
; => #'(LAMBDA (%1 %2) (MAPCAR %2 %1))
(funcall (fn (mapcar %2 %1)) '(1 2 3) (fn (* % %)))
; => 1 4 9
(macroexpand '(fn (apply #'+ 1 2 3 %&)))
; => #'(LAMBDA (&REST %&) (APPLY #'+ 1 2 3 %&))
(funcall (fn (apply #'+ 1 2 3 %&)) 4 5)
; => 15
fnn narg form => lambda-form
Like fn
except that fnn
macro can take the number of arguments of the anonymous function.
(macroexpand '(fnn 3 (eq %2 1)))
; => #'(LAMBDA (#:IGNORE_1_846 %2 #:IGNORE_3_847)
(DECLARE (IGNORE #:IGNORE_1_846 #:IGNORE_3_847))
(EQ %2 1))
(funcall (fnn 3 (eq %2 1)) 3 1 2)
; => T
enable-fn-syntax
By calling this function, you can use special syntax #%(...)
instead of fn
macro. Any forms of fn
macro can be used. If an integer is suppied after #%
, fnn
macro will be used with the integer instead of fn
.
(enable-fn-syntax)
(funcall #%(* % %) 3)
; => 9
(funcall #%3(eq %2 1) 3 1 2)
; => T
Copyright (C) 2011 Tomohiro Matsuyama <tomo@cx4a.org>. Licensed under the LLGPL License.
Next: Files, Previous: Introduction, Up: The cl-anonfun Reference Manual [Contents][Index]
The main system appears first, followed by any subsystem dependency.
Anonymous function helpers for Common Lisp
Tomohiro Matsuyama
LLGPL
0.1
Next: Packages, Previous: Systems, Up: The cl-anonfun Reference Manual [Contents][Index]
Files are sorted by type and then listed depth-first from the systems components trees.
Next: cl-anonfun/package.lisp, Previous: Lisp, Up: Lisp [Contents][Index]
cl-anonfun (system).
Next: cl-anonfun/anonfun.lisp, Previous: cl-anonfun/cl-anonfun.asd, Up: Lisp [Contents][Index]
cl-anonfun (system).
Previous: cl-anonfun/package.lisp, Up: Lisp [Contents][Index]
package.lisp (file).
cl-anonfun (system).
Next: Definitions, Previous: Files, Up: The cl-anonfun Reference Manual [Contents][Index]
Packages are listed by definition order.
Next: cl-anonfun-asd, Previous: Packages, Up: Packages [Contents][Index]
anonfun
common-lisp.
Previous: cl-anonfun, Up: Packages [Contents][Index]
Next: Indexes, Previous: Packages, Up: The cl-anonfun Reference Manual [Contents][Index]
Definitions are sorted by export status, category, package, and then by lexicographic order.
Next: Internals, Previous: Definitions, Up: Definitions [Contents][Index]
Previous: Public Interface, Up: Public Interface [Contents][Index]
Previous: Public Interface, Up: Definitions [Contents][Index]
Package insensitive symbol comparison.
Previous: Definitions, Up: The cl-anonfun Reference Manual [Contents][Index]
Jump to: | %
A E F M S |
---|
Jump to: | %
A E F M S |
---|
Jump to: | A C F P S |
---|
Jump to: | A C F P S |
---|