X.LET-STAR is a binding utility for Common Lisp not unlike metabang-bind, but smaller, extendible, nicely written and bug-free (hopefully :)
To date, it supports:
Other binders can be added trivially with define-binder macro (see let-star.lisp).
X.LET-STAR shadows 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:(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))
expands to:
(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)))))))))
Download ASDF package from http://github.com/ks/X.LET-STAR/raw/master/x.let-star.tar.gz
You can checkout the sources directly as well: X.LET-STAR
License: BSD
This page is linked from: bind WITH macro
CLiki pages can be edited by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively