The cl-anonfun Reference Manual

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

The cl-anonfun Reference Manual

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.

Table of Contents


1 Introduction

cl-anonfun

cl-anonfun is a Common Lisp library that provides a simple anonymous function notation.

Usage

fn

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.

Examples

(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

fnn narg form => lambda-form

Like fn except that fnn macro can take the number of arguments of the anonymous function.

Examples

(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

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.

Examples

(enable-fn-syntax)
(funcall #%(* % %) 3)
; => 9

(funcall #%3(eq %2 1) 3 1 2)
; => T

License

Copyright (C) 2011 Tomohiro Matsuyama <tomo@cx4a.org>. Licensed under the LLGPL License.


2 Systems

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


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

2.1 cl-anonfun

Anonymous function helpers for Common Lisp

Author

Tomohiro Matsuyama

License

LLGPL

Version

0.1

Source

cl-anonfun.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


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

3.1.1 cl-anonfun/cl-anonfun.asd

Source

cl-anonfun.asd.

Parent Component

cl-anonfun (system).

ASDF Systems

cl-anonfun.

Packages

cl-anonfun-asd.


3.1.2 cl-anonfun/package.lisp

Source

cl-anonfun.asd.

Parent Component

cl-anonfun (system).

Packages

cl-anonfun.


3.1.3 cl-anonfun/anonfun.lisp

Dependency

package.lisp (file).

Source

cl-anonfun.asd.

Parent Component

cl-anonfun (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


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

4.1 cl-anonfun

Source

package.lisp.

Nickname

anonfun

Use List

common-lisp.

Public Interface
Internals

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

4.2 cl-anonfun-asd

Source

cl-anonfun.asd.

Use List
  • asdf/interface.
  • common-lisp.

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: enable-fn-syntax ()
Package

cl-anonfun.

Source

anonfun.lisp.

Macro: fn (form)
Package

cl-anonfun.

Source

anonfun.lisp.

Macro: fnn (narg form)
Package

cl-anonfun.

Source

anonfun.lisp.


5.2 Internals


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

5.2.1 Ordinary functions

Function: %enable-fn-syntax ()
Package

cl-anonfun.

Source

anonfun.lisp.

Function: arg-num (arg)
Package

cl-anonfun.

Source

anonfun.lisp.

Function: arg-p (arg)
Package

cl-anonfun.

Source

anonfun.lisp.

Function: extract-args (body)
Package

cl-anonfun.

Source

anonfun.lisp.

Function: fn-reader (stream sub-char numarg)
Package

cl-anonfun.

Source

anonfun.lisp.

Function: make-fn (narg form)
Package

cl-anonfun.

Source

anonfun.lisp.

Function: make-ignore-vars-between (start end)
Package

cl-anonfun.

Source

anonfun.lisp.

Function: make-lambda-list (narg args)
Package

cl-anonfun.

Source

anonfun.lisp.

Function: sort-args (args)
Package

cl-anonfun.

Source

anonfun.lisp.

Function: symbol= (a b)

Package insensitive symbol comparison.

Package

cl-anonfun.

Source

anonfun.lisp.


Appendix A Indexes


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

A.1 Concepts


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

A.3 Variables