What is Nostr?
Thomas /
npub1cr5…sre0
2024-03-18 15:24:34
in reply to nevent1q…wmxn

Thomas on Nostr: npub18nexv…u2mm9 Every functional-minded Lisper has these two classics in a file of ...

npub18nexvs44uwvzhjlp3x3ua3f4n8npw45krta6nv9u5rkddecwnfqqlu2mm9 (npub18ne…2mm9) Every functional-minded Lisper has these two classics in a file of utilities:

(defun compose (proc &rest procs)
"Single value passing internally between procs"
(let* ((procs (reverse (cons proc procs)))
(proc1 (car procs))
(more (cdr procs)))
#'(lambda (&rest args)
(let ((value (apply proc1 args)))
(dolist (proc more)
(setq value (funcall proc value)))
value))))

(defun compose* (proc &rest procs)
"Multiple value passing internally between procs, via returned lists"
(let* ((procs (reverse (cons proc procs)))
(proc1 (car procs))
(more (cdr procs)))
#'(lambda (&rest args)
(let ((value (apply proc1 args)))
(dolist (proc more)
(setq value (apply proc value)))
value))))


Emacs Lisp is a very old-fashioned Lisp, and not even a particularly good example of an old-fashioned Lisp. But, it gets the job done, and is easily extended.
Author Public Key
npub1cr52yqc0ywl5eeveczqdsx8a7g9aysksf5mfhlraxyd5vg37qpgqwrsre0