Function definition: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 1,242:
In TXR, there are pattern functions which are predicates that perform pattern matching and variable capture. A call to this type of function call can specify unbound variables. If the function succeeds, it can establish bindings for those variables.
 
Here is how to make a pattern function that multiplies, and call it. To multiply the numbers, we break out of the pattern language and invoke Lisp evaluation: <code>@(* a b)</langcode>
 
<lang txr>@(define multiply (a b out))
Anonymous user