Short Coding


(multiple-value-bind (q r) (floor 5 3)
  (list q r))
;=> (1 2)

(multiple-value-call #'list (floor 5 3))
;=> (1 2)

(multiple-value-list (floor 5 3))
;=> (1 2)
(let ((a 1) (b 2) (c 3) (d 4))
   (list
    ;; long
    (1- (+ a b c d))
    ;; short
    (+ -1 a b c d)))
;=> (9 9)
;; long
(let ((a 1) (b 2) (c 3) (d 4))
   (list a b c d))
;=> (1 2 3 4)

;; short
((lambda (a b c d)
   (list a b c d))
 1 2 3 4)
;=> (1 2 3 4)

;; cf.
(destructuring-bind (a b c d) '(1 2 3 4)
  (list a b c d))
;; long
(case :foo
  (:foo (format t "foo!~%"))
  (:bar (format t "bar!~%"))
  (:baz (format t "baz!~%")))
;-> foo!
;=> nil

;; short
(format t (case :foo
            (:foo "foo!~%")
            (:bar "bar!~%")
            (:baz "baz!~%")))
;-> foo!
;=> nil