Lisp languages - what do you like about them?

Ok this is an illustration,
I wrote a closed source application 15 years ago that is used to tag unstructured documents. To express some conditions on tags, we define a simple language that can be used by the end user to express theses conditions.

simple extract of some possible expressions:

(defmacro all-inner (&rest tags)
   `(every #'(lambda(tag) (when-bind (io-count (gethash tag io-tags))
            (> io-count 0)))
      ',tags))

(defmacro some-inner (&rest tags)
   `(some #'(lambda(tag) (when-bind (io-count (gethash tag io-tags))
            (> io-count 0)))
      ',tags))

(defmacro none-inner (&rest tags)
   `(notany #'(lambda(tag) (when-bind (io-count (gethash tag io-tags))
            (> io-count 0)))
      ',tags))

(defmacro multi>= (count &rest tags)
   `(some #'(lambda(tag) (when-bind (io-count (gethash tag io-tags))
            (and (> io-count 0) (>= io-count ,count))))
      ',tags))

(defmacro multi<= (count &rest tags)
   `(some #'(lambda(tag) (when-bind (io-count (gethash tag io-tags))
            (and (> io-count 0) (<= io-count ,count))))
      ',tags))

(defmacro multi= (count &rest tags)
   `(some #'(lambda(tag) (when-bind (io-count (gethash tag io-tags))
            (and (> io-count 0) (= io-count ,count))))
      ',tags))

(defmacro all-outer (&rest tags)
   `(every #'(lambda(tag) (when-bind (io-count (gethash tag io-tags))
            (< io-count 0)))
      ',tags))

(defmacro some-outer (&rest tags)
   `(some #'(lambda(tag) (when-bind (io-count (gethash tag io-tags))
            (< io-count 0)))
      ',tags))

(defmacro none-outer (&rest tags)
   `(notany #'(lambda(tag) (when-bind (io-count (gethash tag io-tags))
            (< io-count 0)))
      ',tags))

then the conditions entered by the user are compiled to native code with the following:

(defmethod get-finalized-edit-cond ((scope-cond scope-cond))
   (let ((*package* (find-package :myapp)))
      ;; compile scope cond
      (setf (cond-fn scope-cond)
         (compile nil
            `(lambda (io-tags)
               ,(read-from-string (cond-string scope-cond)))))
      ;; call function to catch potential errors
      (funcall (cond-fn scope-cond) (make-hash-table :size 1))
      scope-cond))

this returns native compiled code that can be run against the whole document to check that the conditions are met or not.

The code of course is missing some parts, but that is the idea.
Cheers,
Sébastien

6 Likes