reorder stuff
This commit is contained in:
parent
88cc27b890
commit
23d93f3d2a
@ -50,22 +50,22 @@ Death to any gui elements in emacs! Do this EARLY so that emacs doesn't redispla
|
|||||||
|
|
||||||
** Compose functions taking arbitrarily many arguments and returning arbitrarily many arguments
|
** Compose functions taking arbitrarily many arguments and returning arbitrarily many arguments
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(defmacro imalison:compose (name &rest funcs)
|
(defun imalison:make-list (thing)
|
||||||
"Build a new function with NAME that is the composition of FUNCS."
|
(if (listp thing)
|
||||||
`(defun ,name (&rest args)
|
thing
|
||||||
(imalison:compose-helper ,funcs)))
|
(list thing)))
|
||||||
|
|
||||||
(defun imalison:make-list (thing)
|
(defmacro imalison:compose (name &rest funcs)
|
||||||
(if (listp thing)
|
"Build a new function with NAME that is the composition of FUNCS."
|
||||||
thing
|
`(defun ,name (&rest args)
|
||||||
(list thing)))
|
(imalison:compose-helper ,funcs)))
|
||||||
|
|
||||||
(defmacro imalison:compose-helper (funcs)
|
(defmacro imalison:compose-helper (funcs)
|
||||||
"Builds funcalls of FUNCS applied to the arg."
|
"Builds funcalls of FUNCS applied to the arg."
|
||||||
(if (equal (length funcs) 0)
|
(if (equal (length funcs) 0)
|
||||||
(quote args)
|
(quote args)
|
||||||
`(apply ,(car funcs)
|
`(apply ,(car funcs)
|
||||||
(imalison:make-list (imalison:compose-helper ,(cdr funcs))))))
|
(imalison:make-list (imalison:compose-helper ,(cdr funcs))))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
** prefix-alternatives
|
** prefix-alternatives
|
||||||
Prefix alternatives is a macro that builds a function that selects one of a collection of functions that are provided to the macro based on the value of the prefix argument.
|
Prefix alternatives is a macro that builds a function that selects one of a collection of functions that are provided to the macro based on the value of the prefix argument.
|
||||||
|
Loading…
Reference in New Issue
Block a user