diff options
Diffstat (limited to 'README.org')
-rw-r--r-- | README.org | 50 |
1 files changed, 27 insertions, 23 deletions
@@ -2,23 +2,22 @@ ALPHA QUALITY -- USE AT YOUR OWN RISK -A simple "one file" system that adds a reader macro for quick lambda -riffing. +Just a reader macro for lambda riffing. ** Examples and Use -To use the system, simply load it. It adds a single reader macro to -you lisp system. +To use the system you only need to load it. It adds a adds a single +reader macro to your Lisp system. If this system has any actual users, and if those users are -dissatisfied with the alteration of the global readtable, let me know -and I can try adapting this for use with named-readtables. +dissatisfied with the alteration of the global read table, let me know +and I can try adapting this for use with =named-readtables=. *** Normal Use -As normally used, lambda-riffs lets you make quick anonymous +As normally used, =lambda-riffs= lets you make quick anonymous functions. There is a special syntax for making variables that start -with $, for example `$x` or `$my-var` +with =$=, for example =$x= or =$my-var=. Here is a basic example @@ -33,14 +32,14 @@ Here is a basic example Outputs : (3 1 6 1 4 2 4 6 4 3 5 1 5 3) -the =#$= syntax is a reader macro dispatch sequence. An symbol that -begins with =$= inside a form that begins with =#$= will be treated as -a parameter of the function being defined. +The =#$= syntax is a reader macro dispatch sequence. Any symbol that +begins with =$= inside a form that prepended by =#$= will be treated +as a parameter of the anonymous function being defined. #+begin_src lisp :results verbatim -(list (funcall #$(list $x $y) 1 2) - (funcall #$(list $x $x $x) 10)) +(list (funcall #$(list $x $y) 1 2) ;; two arguments + (funcall #$(list $x $x $x) 10)) ;; one argument used in three places #+end_src @@ -48,21 +47,26 @@ Outputs : ((1 2) (10 10 10)) -*** Numbered Arguments +*** Numbered Parameters -Examples of numbered arguments: +Examples of numbered parameters: - =$1= , =$2= - =$1-with-a-name= , =$2another-name= -I.e. numbered arguments begin $ and are followed by an integer, and -then any normal variable name characters. +If your form uses numbered parameters, then all of the parameters in +that form should be numbered. -Their effect is to explicitly specify the order of the parameters -being defined. Here is ane example: +I.e. numbered parameters begin =$= and are followed first by an +integer and then any normal variable name characters. + +The effect of numbered parameters is to explicitly specify the order +of the parameters in the anonymouse function being defined. Here is +ane example: #+begin_src lisp :results verbatim +;; flip the order (funcall #$(list $2-symb $1-symb) 'second 'first) #+end_src @@ -77,7 +81,7 @@ Interestingly the numbers do not have to be sequentail, they are merely sorted in ascending order: #+begin_src lisp :results verbatim - +;; $2 < $4 < $10 (funcall #$(list $10 $2 $4) :two :four :ten) #+end_src @@ -87,9 +91,9 @@ Outputs *** Nested Forms -You can nest forms by adding an additional $ to the -dispatch. Variables of nested forms must include the same number of $ -characters as there are in the dispatch form. +You can nest forms by appending an additional $ to the dispatch +sequence. Variables of nested forms must include the same number of $ +characters as there are in their surrounding dispatch sequence. This is easer to understand through example: |