From bf6406908e7869079bfca76e31551421a56b0266 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Tue, 21 Jun 2016 16:12:56 -0700 Subject: [PATCH] Add headings to compose implementations --- dotfiles/emacs.d/README.org | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dotfiles/emacs.d/README.org b/dotfiles/emacs.d/README.org index 7bbe5b76..9d50ad4a 100644 --- a/dotfiles/emacs.d/README.org +++ b/dotfiles/emacs.d/README.org @@ -435,7 +435,7 @@ imalison:named-build is used to name a lambda produced by another macro applied (cons ,builder-name args))) #+END_SRC ** Compose functions -The composed functions can take arbitrarily many arguments and returning arbitrarily many arguments. +*** Arbitrary arguments at every step #+BEGIN_SRC emacs-lisp (defun imalison:make-list (thing) (if (listp thing) @@ -454,8 +454,7 @@ The composed functions can take arbitrarily many arguments and returning arbitra `(apply ,(car funcs) (imalison:make-list (imalison:compose-helper ,(cdr funcs)))))) #+END_SRC - -Here is a unary version which avoids all the calls to imalison:make-list +*** Simpler Unary version #+BEGIN_SRC emacs-lisp (defmacro imalison:compose-unary (&rest funcs) "Build a new function with NAME that is the composition of FUNCS." @@ -468,8 +467,7 @@ Here is a unary version which avoids all the calls to imalison:make-list 'arg `(funcall ,(car funcs) (imalison:compose-helper-unary ,(cdr funcs))))) #+END_SRC - -Here is a version that will support macros and requires unary functions after the first one +*** Most performant version supports macros #+BEGIN_SRC emacs-lisp (defmacro imalison:compose-named-functions (arguments &rest funcs) "Build a new function with NAME that is the composition of FUNCS."