The x.let-star Reference Manual

Table of Contents

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

The x.let-star Reference Manual

This is the x.let-star Reference Manual, generated automatically by Declt version 2.4 "Will Decker" on Wed Jun 20 12:46:17 2018 GMT+0.


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

1 Introduction

X.LET-STAR is a binding/destructuring utility for Common Lisp which currently combines:

a) let* 
b) destructuring-bind
c) :mval - multiple-value-bind
d) :slot - with-slots
e) :slotval - "projection" of slot values of structure/object to local variables,
   avoiding slot lookup every time the slot value is used in the scope
   of let*
f) :accessor - with-accessors
g) :accessorval - "projection" of values retrieved by accessor function to local variables (same concept as e) )
h) :all - binding of a group of variables to one initialization value
i) destructuring of arrays
j) :complex - destructuring of complex numbers 

Destructuring of lists, arrays and multiple values can contain
nested other binders, and also recognizes "don't care" variable _.

A small example of nested sequences destructuring:

(defstruct xxx a b)

(let* (((:mval #(x
                 (y (:complex r i) &rest rest)
                 (:slotval a b))
               (f g))
        (values (vector 10 
                        (list 20 (complex 30 40) 50 60) 
                        (make-xxx :a 70 :b 80))
                (list 90 100))))
  (values x y r i rest a b f g))

It's trivially extendible with DEFINE-BINDER macro, and supports adding
of customized declarations via DEFINE-DECLARATION-PROCESSING macro. 

It's designed as drop-in replacement of common-list:let* (without any changes 
in sources needed) and as almost drop-in replacement for metabang-bind.

X.LET-START shadows common-lisp:let* (since it's completely compatible with common-lisp:let*)
To use the X.LET-STAR library, your defpackage should roughly look as:

(defpackage :your-lib
  (:use :common-lisp :x.let-star ...)
  (:shadowing-import-from x.let-star let*) ;; the important line
  ...)

Example of other features:

(defstruct xxx a b c)

(let* (((_ (e . _) &key (g :xxx)) '(:sdfg (:wert :dfg :tyu) :g 100))      ;; b
       ((:mval h _) (rem 1234 34))                                        ;; c
       ((:slot a (b-first b)) (make-xxx :a 123))                          ;; d
       ((:slotval (b-second b) c) (make-xxx :b 3245 :c 3456))             ;; e
       ((:all x y z) :init))                                              ;; f
   (values e g h a b-first b-second c x y z))

==>

:WERT
100
10
123
NIL
3245
3456
:INIT
:INIT
:INIT

expansion:

(DESTRUCTURING-BIND                                            ;; b
      (#:IGNORE-1021 (E . #:IGNORE-1022) &KEY (G :XXX))        ;; b
    '(:SDFG (:WERT :DFG :TYU) :G 100)                          ;; b
  (DECLARE (IGNORE #:IGNORE-1021) (IGNORE #:IGNORE-1022))      ;; b
  (MULTIPLE-VALUE-BIND                                         ;; c
        (H #:IGNORE-1020)                                      ;; c
      (REM 1234 34)                                            ;; c
    (DECLARE (IGNORE #:IGNORE-1020))                           ;; c
    (WITH-SLOTS (A (B-FIRST B)) (MAKE-XXX :A 123)              ;; d
      (LET ((#:VAL1019 (MAKE-XXX :B 3245 :C 3456)))            ;; e
        (LET ((B-SECOND (SLOT-VALUE #:VAL1019 'B)))            ;; e
          (LET ((C (SLOT-VALUE #:VAL1019 'C)))                 ;; e
            (LET ((#:VAL1139 :INIT))                           ;; f
              (LET ((X #:VAL1139) (Y #:VAL1139) (Z #:VAL1139)) ;; f 
                (VALUES E G H A B-FIRST B-SECOND C X Y Z)))))))))
    
More binders will be added in future as the need arises. 



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 x.let-star

Author

karol.skocik@gmail.com

License

BSD compatible

Description

value binder

Source

x.let-star.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 x.let-star.asd

Location

x.let-star.asd

Systems

x.let-star (system)


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

3.1.2 x.let-star/package.lisp

Parent

x.let-star (system)

Location

package.lisp

Packages

x.let-star


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

3.1.3 x.let-star/common.lisp

Dependency

package.lisp (file)

Parent

x.let-star (system)

Location

common.lisp

Internal Definitions

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

3.1.4 x.let-star/declarations.lisp

Dependency

common.lisp (file)

Parent

x.let-star (system)

Location

declarations.lisp

Internal Definitions

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

3.1.5 x.let-star/let-star.lisp

Dependency

declarations.lisp (file)

Parent

x.let-star (system)

Location

let-star.lisp

Exported Definitions

let* (macro)

Internal Definitions

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

3.1.6 x.let-star/tests.lisp

Dependency

let-star.lisp (file)

Parent

x.let-star (system)

Location

tests.lisp

Packages

x.let-star-test

Internal Definitions

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

4 Packages

Packages are listed by definition order.


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

4.1 x.let-star

Source

package.lisp (file)

Use List

common-lisp

Used By List

x.let-star-test

Exported Definitions

let* (macro)

Internal Definitions

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

4.2 x.let-star-test

Source

tests.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.


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

5.1 Exported definitions


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

5.1.1 Macros

Macro: let* (&rest FORMS) &body BODY
Package

x.let-star

Source

let-star.lisp (file)


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

5.2 Internal definitions


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

5.2.1 Special variables

Special Variable: *binder-specs*
Package

x.let-star

Source

common.lisp (file)

Special Variable: *declaration-specs*
Package

x.let-star

Source

common.lisp (file)

Special Variable: *lambda-list-markers*
Package

x.let-star

Source

common.lisp (file)

Special Variable: *lambda-list-markers-with-initializer*
Package

x.let-star

Source

common.lisp (file)

Special Variable: *tests*
Package

x.let-star-test

Source

tests.lisp (file)


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

5.2.2 Macros

Macro: define-binder (SPEC VAR VAL DECLS BODY) &body BINDER-BODY
Package

x.let-star

Source

let-star.lisp (file)

Macro: define-declaration-processing (SPEC FORM) &body BODY
Package

x.let-star

Source

declarations.lisp (file)

Macro: deftest NAME &body BODY
Package

x.let-star-test

Source

tests.lisp (file)

Macro: when-let (VAR TEST) &body BODY
Package

x.let-star

Source

common.lisp (file)


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

5.2.3 Functions

Function: copy-xxx INSTANCE
Package

x.let-star-test

Source

tests.lisp (file)

Function: extract-nested-binding-specs VARS DECLS &key EXTRACT-PLAIN-LISTS
Package

x.let-star

Source

common.lisp (file)

Function: find-gensyms FORM
Package

x.let-star-test

Source

tests.lisp (file)

Function: flatten-filter FN TREE
Package

x.let-star-test

Source

tests.lisp (file)

Function: ignore-symbol-p SYMBOL &optional IGNORE-SYM
Package

x.let-star

Source

common.lisp (file)

Function: ignore-varname-p SYMBOL
Package

x.let-star

Source

common.lisp (file)

Function: lambda-list-vars LIST
Package

x.let-star

Source

common.lisp (file)

Function: make-xxx &key (X X) (Y Y) (Z Z)
Package

x.let-star-test

Source

tests.lisp (file)

Function: map-lambda-list LIST LEAF-FN &optional CONS-FN
Package

x.let-star

Source

common.lisp (file)

Function: merge-hash-tables MAIN-TABLE OTHER-TABLE
Package

x.let-star

Source

common.lisp (file)

Function: parse-binding FORM
Package

x.let-star

Source

common.lisp (file)

Function: process-common-declaration SPEC FORM &optional DECL-FORM-FN
Package

x.let-star

Source

declarations.lisp (file)

Function: process-declarations BODY
Package

x.let-star

Source

declarations.lisp (file)

Function: run-tests &optional CHATTY?
Package

x.let-star-test

Source

tests.lisp (file)

Function: skip-declaration SPEC FORM
Package

x.let-star

Source

declarations.lisp (file)

Function: strip-declarations BODY &optional DECLS
Package

x.let-star

Source

declarations.lisp (file)

Function: use-declaration VAR VARIABLE-DECLS
Package

x.let-star

Source

declarations.lisp (file)

Function: valid-varname-p SYMBOL
Package

x.let-star

Source

common.lisp (file)

Function: xxx-p OBJECT
Package

x.let-star-test

Source

tests.lisp (file)

Function: xxx-x INSTANCE
Function: (setf xxx-x) VALUE INSTANCE
Package

x.let-star-test

Source

tests.lisp (file)

Function: xxx-y INSTANCE
Function: (setf xxx-y) VALUE INSTANCE
Package

x.let-star-test

Source

tests.lisp (file)

Function: xxx-z INSTANCE
Function: (setf xxx-z) VALUE INSTANCE
Package

x.let-star-test

Source

tests.lisp (file)


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

5.2.4 Generic functions

Generic Function: expand-binding SPEC VAR VAL DECLS BODY
Package

x.let-star

Source

let-star.lisp (file)

Methods
Method: expand-binding (SPEC0 (eql complex)) (VAR list) VAL DECLS BODY
Method: expand-binding (SPEC0 (eql all)) (VAR list) VAL DECLS BODY
Method: expand-binding (SPEC0 (eql accessorval)) (VAR list) VAL DECLS BODY
Method: expand-binding (SPEC0 (eql accessor)) (VAR list) VAL DECLS BODY
Method: expand-binding (SPEC0 (eql slotval)) (VAR list) VAL DECLS BODY
Method: expand-binding (SPEC0 (eql slot)) (VAR list) VAL DECLS BODY
Method: expand-binding (SPEC20 (eql mval)) (VAR list) VAL DECLS BODY
Method: expand-binding (SPEC5 (eql nil)) (VAR list) VAL DECLS BODY
Method: expand-binding (SPEC0 (eql nil)) (VAR vector) VAL DECLS BODY
Method: expand-binding (SPEC0 (eql nil)) VAR (VAL (eql nil)) DECLS BODY
Method: expand-binding (SPEC0 (eql nil)) (VAR (eql nil)) (VAL (eql nil)) DECLS BODY
Method: expand-binding (SPEC0 (eql nil)) VAR VAL DECLS BODY
Generic Function: process-declaration SPEC FORM
Package

x.let-star

Source

declarations.lisp (file)

Methods
Method: process-declaration (SPEC0 (eql notinline)) FORM
Method: process-declaration (SPEC0 (eql inline)) FORM
Method: process-declaration (SPEC0 (eql ftype)) FORM
Method: process-declaration (SPEC0 (eql optimize)) FORM
Method: process-declaration (SPEC0 (eql type)) FORM
Method: process-declaration (SPEC0 (eql dynamic-extent)) FORM
Method: process-declaration (SPEC0 (eql special)) FORM
Method: process-declaration (SPEC0 (eql ignorable)) FORM
Method: process-declaration (SPEC0 (eql ignore)) FORM

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

5.2.5 Structures

Structure: xxx ()
Package

x.let-star-test

Source

tests.lisp (file)

Direct superclasses

structure-object (structure)

Direct slots
Slot: x
Readers

xxx-x (function)

Writers

(setf xxx-x) (function)

Slot: y
Readers

xxx-y (function)

Writers

(setf xxx-y) (function)

Slot: z
Readers

xxx-z (function)

Writers

(setf xxx-z) (function)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   F   L   X  
Index Entry  Section

F
File, Lisp, x.let-star.asd: The x<dot>let-star<dot>asd file
File, Lisp, x.let-star/common.lisp: The x<dot>let-star/common<dot>lisp file
File, Lisp, x.let-star/declarations.lisp: The x<dot>let-star/declarations<dot>lisp file
File, Lisp, x.let-star/let-star.lisp: The x<dot>let-star/let-star<dot>lisp file
File, Lisp, x.let-star/package.lisp: The x<dot>let-star/package<dot>lisp file
File, Lisp, x.let-star/tests.lisp: The x<dot>let-star/tests<dot>lisp file

L
Lisp File, x.let-star.asd: The x<dot>let-star<dot>asd file
Lisp File, x.let-star/common.lisp: The x<dot>let-star/common<dot>lisp file
Lisp File, x.let-star/declarations.lisp: The x<dot>let-star/declarations<dot>lisp file
Lisp File, x.let-star/let-star.lisp: The x<dot>let-star/let-star<dot>lisp file
Lisp File, x.let-star/package.lisp: The x<dot>let-star/package<dot>lisp file
Lisp File, x.let-star/tests.lisp: The x<dot>let-star/tests<dot>lisp file

X
x.let-star.asd: The x<dot>let-star<dot>asd file
x.let-star/common.lisp: The x<dot>let-star/common<dot>lisp file
x.let-star/declarations.lisp: The x<dot>let-star/declarations<dot>lisp file
x.let-star/let-star.lisp: The x<dot>let-star/let-star<dot>lisp file
x.let-star/package.lisp: The x<dot>let-star/package<dot>lisp file
x.let-star/tests.lisp: The x<dot>let-star/tests<dot>lisp file

Jump to:   F   L   X  

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

A.2 Functions

Jump to:   (  
C   D   E   F   G   I   L   M   P   R   S   U   V   W   X  
Index Entry  Section

(
(setf xxx-x): Internal functions
(setf xxx-y): Internal functions
(setf xxx-z): Internal functions

C
copy-xxx: Internal functions

D
define-binder: Internal macros
define-declaration-processing: Internal macros
deftest: Internal macros

E
expand-binding: Internal generic functions
expand-binding: Internal generic functions
expand-binding: Internal generic functions
expand-binding: Internal generic functions
expand-binding: Internal generic functions
expand-binding: Internal generic functions
expand-binding: Internal generic functions
expand-binding: Internal generic functions
expand-binding: Internal generic functions
expand-binding: Internal generic functions
expand-binding: Internal generic functions
expand-binding: Internal generic functions
expand-binding: Internal generic functions
extract-nested-binding-specs: Internal functions

F
find-gensyms: Internal functions
flatten-filter: Internal functions
Function, (setf xxx-x): Internal functions
Function, (setf xxx-y): Internal functions
Function, (setf xxx-z): Internal functions
Function, copy-xxx: Internal functions
Function, extract-nested-binding-specs: Internal functions
Function, find-gensyms: Internal functions
Function, flatten-filter: Internal functions
Function, ignore-symbol-p: Internal functions
Function, ignore-varname-p: Internal functions
Function, lambda-list-vars: Internal functions
Function, make-xxx: Internal functions
Function, map-lambda-list: Internal functions
Function, merge-hash-tables: Internal functions
Function, parse-binding: Internal functions
Function, process-common-declaration: Internal functions
Function, process-declarations: Internal functions
Function, run-tests: Internal functions
Function, skip-declaration: Internal functions
Function, strip-declarations: Internal functions
Function, use-declaration: Internal functions
Function, valid-varname-p: Internal functions
Function, xxx-p: Internal functions
Function, xxx-x: Internal functions
Function, xxx-y: Internal functions
Function, xxx-z: Internal functions

G
Generic Function, expand-binding: Internal generic functions
Generic Function, process-declaration: Internal generic functions

I
ignore-symbol-p: Internal functions
ignore-varname-p: Internal functions

L
lambda-list-vars: Internal functions
let*: Exported macros

M
Macro, define-binder: Internal macros
Macro, define-declaration-processing: Internal macros
Macro, deftest: Internal macros
Macro, let*: Exported macros
Macro, when-let: Internal macros
make-xxx: Internal functions
map-lambda-list: Internal functions
merge-hash-tables: Internal functions
Method, expand-binding: Internal generic functions
Method, expand-binding: Internal generic functions
Method, expand-binding: Internal generic functions
Method, expand-binding: Internal generic functions
Method, expand-binding: Internal generic functions
Method, expand-binding: Internal generic functions
Method, expand-binding: Internal generic functions
Method, expand-binding: Internal generic functions
Method, expand-binding: Internal generic functions
Method, expand-binding: Internal generic functions
Method, expand-binding: Internal generic functions
Method, expand-binding: Internal generic functions
Method, process-declaration: Internal generic functions
Method, process-declaration: Internal generic functions
Method, process-declaration: Internal generic functions
Method, process-declaration: Internal generic functions
Method, process-declaration: Internal generic functions
Method, process-declaration: Internal generic functions
Method, process-declaration: Internal generic functions
Method, process-declaration: Internal generic functions
Method, process-declaration: Internal generic functions

P
parse-binding: Internal functions
process-common-declaration: Internal functions
process-declaration: Internal generic functions
process-declaration: Internal generic functions
process-declaration: Internal generic functions
process-declaration: Internal generic functions
process-declaration: Internal generic functions
process-declaration: Internal generic functions
process-declaration: Internal generic functions
process-declaration: Internal generic functions
process-declaration: Internal generic functions
process-declaration: Internal generic functions
process-declarations: Internal functions

R
run-tests: Internal functions

S
skip-declaration: Internal functions
strip-declarations: Internal functions

U
use-declaration: Internal functions

V
valid-varname-p: Internal functions

W
when-let: Internal macros

X
xxx-p: Internal functions
xxx-x: Internal functions
xxx-y: Internal functions
xxx-z: Internal functions

Jump to:   (  
C   D   E   F   G   I   L   M   P   R   S   U   V   W   X  

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

A.3 Variables

Jump to:   *  
S   X   Y   Z  
Index Entry  Section

*
*binder-specs*: Internal special variables
*declaration-specs*: Internal special variables
*lambda-list-markers*: Internal special variables
*lambda-list-markers-with-initializer*: Internal special variables
*tests*: Internal special variables

S
Slot, x: Internal structures
Slot, y: Internal structures
Slot, z: Internal structures
Special Variable, *binder-specs*: Internal special variables
Special Variable, *declaration-specs*: Internal special variables
Special Variable, *lambda-list-markers*: Internal special variables
Special Variable, *lambda-list-markers-with-initializer*: Internal special variables
Special Variable, *tests*: Internal special variables

X
x: Internal structures

Y
y: Internal structures

Z
z: Internal structures

Jump to:   *  
S   X   Y   Z  

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

A.4 Data types

Jump to:   P   S   X  
Index Entry  Section

P
Package, x.let-star: The x<dot>let-star package
Package, x.let-star-test: The x<dot>let-star-test package

S
Structure, xxx: Internal structures
System, x.let-star: The x<dot>let-star system

X
x.let-star: The x<dot>let-star system
x.let-star: The x<dot>let-star package
x.let-star-test: The x<dot>let-star-test package
xxx: Internal structures

Jump to:   P   S   X