Programming Language for Old Timers

by David A. Moon
February 2006 .. September 2008

Comments and criticisms to dave underscore moon atsign alum dot mit dot edu.

Previous page   Table of Contents   Next page


The arguments in a function call using the infix ( operator are the values of a comma-separated list of expressions. A newline is allowed after each comma.

To increase the readability of a call to a function that has keyword parameters, any argument expression can be preceded by a keyword. This becomes two arguments, the simple-name corresponding to the keyword and the value of the expression. The first argument typically selects the function parameter whose definition in the body of the function will be the second argument. Of course this syntax can be used in any function call, regardless of the parameter-list of the callee function.

In addition, any argument can be a sequence that is "spread" by the function call so that each element of the sequence becomes an individual argument. This is indicated by appending the particle ... to the argument expression. The output of the argument-list parser uses the keyword "...:", which cannot be written in source code but can be created by calling the constructor keyword("..."), as a flag to indicate that the preceding argument is to be spread. The function maybe-spread-invocation, called by the infix parenthesis and dot operator macros, recognizes this flag.

An argument expression can also be a curried function.

The syntax could be defined by:

defparser argument-list
  { [ ?:keyword ] ?arg is expression-or-lambda [ ??spread ... ] & , ^^ }* => ...

Previous page   Table of Contents   Next page