Optional positional and named parameters in Spheres

First of all, you will need to import core macros. For the REPL:

Support for Python 2.5 has turned off. Please refer to https://goo.gl/aESk5L for more informatio

For a Fusion project:

Support for Python 2.5 has turned off. Please refer to https://goo.gl/aESk5L for more informatio

How does it work?

It works just like SRFI-89, but with a slight variation: keyword parameters (named parameters) aren't followed by a variable name, because the keyword itself is turned into the variable (thus removing the redundancy and directly translating into DSSSL):

Support for Python 2.5 has turned off. Please refer to https://goo.gl/aESk5L for more informatio

Explanation

There is no standard solution to write portable optional and positional parameters. There are different options, depending on the Scheme system, but there are two that are most commonly used: DSSSL and SRFI-89.

In the Gambit world, the DSSSL extension is more extended, since it is implemented by the compiler. However paradoxical, SRFI-89 reference documentation is implemented for Gambit by Marc Feeley, who writes: Unfortunately several people, including the author of this SRFI, feel that the DSSSL formal parameter list syntax is messy. Although the DSSSL syntax has widespread support among the implementations of Scheme with optional parameters we think there is a high likelihood that these implementations of Scheme may evolve to include this proposal (a majority of the implementors of these systems have confirmed that they are willing to consider implementing a new approach). Therefore this SRFI specifies a parameter passing mechanism that has similar functionality to DSSSL, but a more elegant formal parameter list syntax.

SchemeSpheres relies on a slight variation of SRFI-89, that removes redundancy and directly translates to the DSSSL equivalent. Being a macro extension, it can be modified in the future to translate to both DSSSL and SRFI-89 with ease, choosing the available or best performing option. As is the case for Gambit, it translates to DSSSL, thus removing the need of procedures at runtime.

Differences with SRFI-89

This solution could be easily turned into SRFI-89-compatible code by adding a variable after the keyword, named exactly like the keyword. For example:

Support for Python 2.5 has turned off. Please refer to https://goo.gl/aESk5L for more informatio