Next: , Previous: Avoiding Conflicts, Up: Top


Appendix C Star Suffix

Several of Loopless' utilities have ‘*’ as a suffix.
This is, of course, because Loopless is an ALL-STAR library!
Joking aside, here's a full breakdown of why for each operator:

Slight variation on another operator
mapal*/mapalist*/mapacon*
doalist*
These are just like the non-starred equivalents except they consider the value to be in the second element instead of the cdr.
mapt*/maptimes*/maptcon*
dotimes*
These are just like the non-starred equivalents except you don't have to (and must not) supply a variable name. This relieves you from having to name and then ignore the variable if you won't be using it anyway and makes it clear that you won't (useful if you have a big code block).

Protection against symbol conflicts and programmer confusion
for*
while*
To avoid symbol conflicts and potential programmer confusion with the loop keywords for and while. These are also “clashy” names that other utility libraries might use (but maybe I'm just paranoid).

Anyway, the semantics differ between the loop keywords and these new operators so it makes sense to give them a different name. Just adding a ‘*’ is short and simple.

Also, the binding of variables is done sequentially as in let*, do* and prog*.

As a minor bonus, adding the suffix to for is consistent with its local function step*, which itself cannot use just step as a name.

step*
The step* local function is used inside for* to step the variables. Common Lisp already provides a step macro, which is an unrelated operator to aid debugging.

Here again, the semantics differ (this time wildly) so using a different name is appropriate.