Macro: FN

Documentation

builds a function taking one argument and applying this arg to included functions. syntax: (fn <expr>) <expr> ::= function | (operator <expr>*) semantics: <expr> is recursivle translated into: (lambda (x) (f1 (fa x) (fb x) (fc x))) where fa, fb, fc might be translated although if satisfie pattern: (operator <expr>*) e.g. (fn f1) -> #'f1 (fn f1 fa fb) -> (lambda (x) (f1 (fa x) (fb x))) (fn f1 (f2 fa fb) fc) -> (lambda (x) (f1 ((lambda (y) (f2 (fa y) (fb y))) x) (fc x))) --(in mind subst. lambda)--> (lambda (x) (f1 (f2 (fa x) (fb x)) (fc x)))

Source

(defmacro fn (expr)
  "builds a function taking one argument and applying this arg
   to included functions.
   syntax: (fn <expr>)
           <expr> ::= function | (operator <expr>*)
   semantics:
           <expr> is recursivle translated into:
                  (lambda (x) (f1
                                (fa x)
                                (fb x)
                                (fc x)))
                  where fa, fb, fc might be translated although 
                  if satisfie pattern: (operator <expr>*)
   e.g. (fn f1) -> #'f1
        (fn f1 fa fb) -> (lambda (x) (f1 (fa x) (fb x)))
        (fn f1 (f2 fa fb) fc) ->
          (lambda (x) 
            (f1 ((lambda (y) (f2 (fa y)
                                 (fb y)))
                          x)
                         (fc x))) 
                 --(in mind subst. lambda)-->
                   (lambda (x) (f1 (f2 (fa x)
                                       (fb x))
                                   (fc x)))
                      "
  `#',(rbuild expr))
Source Context