[alexandria-devel] Nesting

Faré fahree at gmail.com
Sat May 26 20:43:18 UTC 2012


I've found the following definitions incredibly useful in
(nest) allowing indentation to not get out of hand
(nest) getting the good feeling of that binding has other languages
(tsen) focusing on the thing at hand, not the intermediate definitions needed
(tsen) "piping" results into a series of functions or forms.

I don't like the name "tsen", though. "wrap" comes to mind.
Maybe you have better suggestions.

;;; Nesting binding forms (from a suggestion by marco baringer)
(defmacro with-nesting ((&key (from-end t)) &rest things)
  (if from-end `(nest , at things) `(tsen , at things)))

(defmacro nest (&rest things)
  (reduce #'(lambda (outer inner) (append outer (list inner)))
          things :from-end t))

(defmacro tsen (&rest things)
  (reduce #'(lambda (inner outer) (append outer (list inner)))
          things :from-end nil))

In any case, I'd like these to become a standard part of alexandria.

—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org
Gauss, when asked how soon he expected to reach certain mathematical
conclusions, replied that he had reached them long ago, all he was worrying
about was how to reach them! [Karl F. Gauss (1777-1855), German mathematician]




More information about the alexandria-devel mailing list