Node:Keyword tuples, Next:, Previous:Tuples, Up:Functions



Keyword tuples

(NOT IMPLEMENTED!)

Positional parameters correspons to normal tuples. But what about keyword parameters? One possibility is to defined keyword tuples.

An environment is a mapping from a set of names to values, just like a sequence is a mapping from (part of) the integers to values. The tupling operator @ yields a normal tuple from a sequence; we can also define it to yield a keyword tuple from an environment.

A keyword parameter name:value is a keyword tuple (with one element/binding).

There can now be two tuple formals. The first bundles up the unused positional parameters, and defines a sequence. The second (if any) bundles up the keyword parameters, and defines an environment. (In addition, there can be a tuple formal for left-hand arguments.) (If you want no positional parameters, just make the first tuple formal be []@.)

[x:3 y:4] == (:|x=3; :|y=4).