ia-hash-table

2016-03-18

Main purpose is to be able to use strings as real keys but do gethash with symbols and vice versa. Can be useful for things like http headers parsing (no more intern leaks), json apis with/without https://github.com/AccelerationNet/access. Only tested on SBCL. Expected to work on Allegro, CCL and LW. Also provides nil safe dot syntax

Upstream URL

github.com/deadtrickster/ia-hash-table

Author

Ilya Khaprov <ilya.kharpov@publitechs.com>, Ilya Khaprov <ilya.khaprov@publitechs.com> and CONTRIBUTORS

Maintainer

Ilya Khaprov <ilya.khaprov@publitechs.com>

License

MIT
README

IA-HASH-TABLE Build Status Coverage Status

Examples


CL-USER> (defvar ht (ia-hash-table:make-ia-hash-table))
HT
CL-USER> (setf (gethash "qwe" ht) 1)
1
CL-USER> (gethash :qwe ht)
1
T
(enable-ia-syntax)

(defparameter response (alist-ia-hash-table '(("name" . "John Smith")
                                              ("age" . 34)
                                              ("city" . "New York")
                                              ("account" . (("checking" . 36223)
                                                            ("saving" . 468300))))))

>> #Iresponse.name
"John Smith"

>> #Iresponse.account.saving
468300

>> #Iresponse.address
NIL

>> #Iresponse.address.state
The value NIL is not of type HASH-TABLE.

>> #Iresponse.address?.state
NIL

;; or even
(defparameter nil-response nil)

>> #Inil-response?.account.saving
NIL

Dependencies (6)

  • alexandria
  • cl-interpol
  • log4cl
  • mw-equiv
  • prove
  • split-sequence

Dependents (0)

    • GitHub
    • Quicklisp