The cl-hash-table-destructuring Reference Manual

Table of Contents

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

The cl-hash-table-destructuring Reference Manual

This is the cl-hash-table-destructuring Reference Manual, version 0.0.1, generated automatically by Declt version 2.4 "Will Decker" on Wed Jun 20 11:10:25 2018 GMT+0.


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

1 Introduction

CL-HASH-TABLE-DESTRUCTURING

Hash table destructuring utils. Design similar to the with-slots macro.

(let ((ht (make-hash-table)))
  (with-hash-table-items (x (y :y) z) ht
    (setf x 1
          y 2
          z 3))
  (let (result)
    (maphash (lambda (key value)
               (push (cons key value) result))
             ht)
    result))

;; ((Z . 3) (:Y . 2) (X . 1))

(let ((ht (make-hash-table :test #'equal)))
  (with-hash-table-items-fn (x (y :y) z) (ht #'string)
    (setf x 1
          y 2
          z 3))
  (let (result)
    (maphash (lambda (key value)
               (push (cons key value) result))
             ht)
    result))

;; (("Z" . 3) (:Y . 2) ("X" . 1))

Installation (via Quicklisp)

(ql:quickload "cl-hash-table-destructuring")

Run tests

(asdf:test-system :cl-hash-table-destructuring)

Documentation

Macro WITH-HASH-TABLE-ITEMS, WITH-HASH-TABLE-ITEMS-FN

Syntax

with-hash-table-items (entry*) hash-table-form declaration* form*
with-hash-table-items-fn (entry*) (hash-table-form keyfn) declaration* form*

entry ::= variable-name | (variable-name key-form)

Examples

(let ((ht (make-hash-table)))
  (with-hash-table-items (x (y :y) z) ht
    (setf x 1
          y 2
          z 3))
  (values (gethash 'x ht)
          (gethash :y ht)
          (gethash 'z ht)))

;; 1
;; 2
;; 3
(flet ((make-keyword (sym) (intern (string sym) :keyword)))
  (let ((ht (make-hash-table)))
    (let ((*keyfn* #'make-keyword))
      (with-hash-table-items (foo bar baz) ht
        (setf foo :foo
              bar :bar
              baz :baz))
      (with-hash-table-items (foo bar baz) ht
        (values foo
                bar
                baz)))))

;; :FOO
;; :BAR
;; :BAZ
(flet ((make-keyword (sym) (intern (string sym) :keyword)))
  (let ((ht (make-hash-table)))
    (with-hash-table-items-fn (foo bar baz) (ht #'make-keyword)
      (setf foo :foo
            bar :bar
            baz :baz))
    (with-hash-table-items-fn (foo bar baz) (ht #'make-keyword)
      (values foo
              bar
              baz))))

;; :FOO
;; :BAR
;; :BAZ

Macro WITH-HASH-TABLE-VALUES, WITH-HASH-TABLE-VALUES-FN

Syntax

with-hash-table-values (entry*) hash-table-form declaration* form*
with-hash-table-values-fn (entry*) (hash-table-form keyfn) declaration* form*

entry ::= variable-name | (variable-name key-form)

Examples

(let ((ht (make-hash-table)))
  (with-hash-table-items (x y z) ht
    (setf x 1
          y 2
          z 3))
  (let (result)
    (with-hash-table-values (x y z) ht
      (setf result (list x y z))
      (setf x :x
            y :y
            z :z))
    (with-hash-table-values (x y z) ht
      (values result
              (list x y z)))))

;; (1 2 3)
;; (1 2 3)

License

Copyright © 2016 Andrey V. Tikhonov <andrey.tikhonov.mailbox@gmail.com>
This work is free. You can redistribute it and/or modify it under the
terms of the Do What The Fuck You Want To Public License, Version 2,
as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.

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 cl-hash-table-destructuring

Author

Andrey V. Tikhonov <andrey.tikhonov.mailbox@gmail.com>

License

WTFPL

Description

Hash table destructuring utils

Version

0.0.1

Source

cl-hash-table-destructuring.asd (file)

Component

src (module)


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

3 Modules

Modules are listed depth-first from the system components tree.


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

3.1 cl-hash-table-destructuring/src

Parent

cl-hash-table-destructuring (system)

Location

src/

Component

cl-hash-table-destructuring.lisp (file)


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

4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


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

4.1 Lisp


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

4.1.1 cl-hash-table-destructuring.asd

Location

cl-hash-table-destructuring.asd

Systems

cl-hash-table-destructuring (system)

Packages

cl-hash-table-destructuring-asd


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

4.1.2 cl-hash-table-destructuring/src/cl-hash-table-destructuring.lisp

Parent

src (module)

Location

src/cl-hash-table-destructuring.lisp

Packages

cl-hash-table-destructuring

Exported Definitions
Internal Definitions

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

5 Packages

Packages are listed by definition order.


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

5.1 cl-hash-table-destructuring-asd

Source

cl-hash-table-destructuring.asd

Use List

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

5.2 cl-hash-table-destructuring

Source

cl-hash-table-destructuring.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

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

6 Definitions

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


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

6.1 Exported definitions


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

6.1.1 Special variables

Special Variable: *keyfn*
Package

cl-hash-table-destructuring

Source

cl-hash-table-destructuring.lisp (file)


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

6.1.2 Macros

Macro: with-hash-table-items (&rest ENTRIES) HASH-TABLE-FORM &body BODY
Package

cl-hash-table-destructuring

Source

cl-hash-table-destructuring.lisp (file)

Macro: with-hash-table-items-fn (&rest ENTRIES) (HASH-TABLE-FORM KEYFN) &body BODY
Package

cl-hash-table-destructuring

Source

cl-hash-table-destructuring.lisp (file)

Macro: with-hash-table-values (&rest ENTRIES) HASH-TABLE-FORM &body BODY
Package

cl-hash-table-destructuring

Source

cl-hash-table-destructuring.lisp (file)

Macro: with-hash-table-values-fn (&rest ENTRIES) (HASH-TABLE-FORM KEYFN) &body BODY
Package

cl-hash-table-destructuring

Source

cl-hash-table-destructuring.lisp (file)


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

6.2 Internal definitions


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

6.2.1 Macros

Macro: defhelper FUNCTION-NAME LAMBDA-LIST &body FORMS
Package

cl-hash-table-destructuring

Source

cl-hash-table-destructuring.lisp (file)


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

6.2.2 Functions

Function: make-expansions FORMS HASH-TABLE-NAME
Package

cl-hash-table-destructuring

Source

cl-hash-table-destructuring.lisp (file)

Function: make-key-forms ENTRIES KEYFN-NAME
Package

cl-hash-table-destructuring

Source

cl-hash-table-destructuring.lisp (file)

Function: make-names ENTRIES
Package

cl-hash-table-destructuring

Source

cl-hash-table-destructuring.lisp (file)


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

6.2.3 Types

Type: function-designator ()
Package

cl-hash-table-destructuring

Source

cl-hash-table-destructuring.lisp (file)

Type: item-entry ()
Package

cl-hash-table-destructuring

Source

cl-hash-table-destructuring.lisp (file)

Type: non-keyword-symbol ()
Package

cl-hash-table-destructuring

Source

cl-hash-table-destructuring.lisp (file)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   C   F   L   M  
Index Entry  Section

C
cl-hash-table-destructuring.asd: The cl-hash-table-destructuring<dot>asd file
cl-hash-table-destructuring/src: The cl-hash-table-destructuring/src module
cl-hash-table-destructuring/src/cl-hash-table-destructuring.lisp: The cl-hash-table-destructuring/src/cl-hash-table-destructuring<dot>lisp file

F
File, Lisp, cl-hash-table-destructuring.asd: The cl-hash-table-destructuring<dot>asd file
File, Lisp, cl-hash-table-destructuring/src/cl-hash-table-destructuring.lisp: The cl-hash-table-destructuring/src/cl-hash-table-destructuring<dot>lisp file

L
Lisp File, cl-hash-table-destructuring.asd: The cl-hash-table-destructuring<dot>asd file
Lisp File, cl-hash-table-destructuring/src/cl-hash-table-destructuring.lisp: The cl-hash-table-destructuring/src/cl-hash-table-destructuring<dot>lisp file

M
Module, cl-hash-table-destructuring/src: The cl-hash-table-destructuring/src module

Jump to:   C   F   L   M  

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

A.2 Functions

Jump to:   D   F   M   W  
Index Entry  Section

D
defhelper: Internal macros

F
Function, make-expansions: Internal functions
Function, make-key-forms: Internal functions
Function, make-names: Internal functions

M
Macro, defhelper: Internal macros
Macro, with-hash-table-items: Exported macros
Macro, with-hash-table-items-fn: Exported macros
Macro, with-hash-table-values: Exported macros
Macro, with-hash-table-values-fn: Exported macros
make-expansions: Internal functions
make-key-forms: Internal functions
make-names: Internal functions

W
with-hash-table-items: Exported macros
with-hash-table-items-fn: Exported macros
with-hash-table-values: Exported macros
with-hash-table-values-fn: Exported macros

Jump to:   D   F   M   W  

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

A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*keyfn*: Exported special variables

S
Special Variable, *keyfn*: Exported special variables

Jump to:   *  
S  

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

A.4 Data types

Jump to:   C   F   I   N   P   S   T  
Index Entry  Section

C
cl-hash-table-destructuring: The cl-hash-table-destructuring system
cl-hash-table-destructuring: The cl-hash-table-destructuring package
cl-hash-table-destructuring-asd: The cl-hash-table-destructuring-asd package

F
function-designator: Internal types

I
item-entry: Internal types

N
non-keyword-symbol: Internal types

P
Package, cl-hash-table-destructuring: The cl-hash-table-destructuring package
Package, cl-hash-table-destructuring-asd: The cl-hash-table-destructuring-asd package

S
System, cl-hash-table-destructuring: The cl-hash-table-destructuring system

T
Type, function-designator: Internal types
Type, item-entry: Internal types
Type, non-keyword-symbol: Internal types

Jump to:   C   F   I   N   P   S   T