X LET-STAR is a convenience library not unlike bind, but smaller, extendible, nicely written and bug-free (hopefully :)

To date, it supports:

  • let*
  • destructuring-bind (with "don't care" variable _)
  • multiple-value-bind (with "don't care" variable _)
  • with-slots
  • "projection" of slot values of structure/object to normal values, avoiding slot lookup every time the slot value is used in the scope of let*
  • binding of a group of variables to one initialization value

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


(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)))))))))

You can checkout the sources directly as well: X.LET-STAR

License: BSD