Arc Forumnew | comments | leaders | submitlogin
3 points by prestonbriggs 2629 days ago | link | parent

Offhand, I can think of 3 places where dots are used in Arc. 1) for improper lists (where the cdr of the final cons is not nil), 2) in parameter lists, to indicate that all remaining arguments are to be collected into a list and assigned to a single parameter, and 3) as a syntactic abbreviation. I'm guessing you're referring to the 3rd use, since it's a departure from earlier dialects of Lisp.

When the compiler sees a sequence of non-whitespace characters, it has to decide what it represents. Might be something important like a parenthesis, a character constant, a string, or a number. If it's none of the above, then it's probably a symbol. But before it decides on symbol, it first checks to see if it's a syntactic abbreviation, looking for for one of the special characters: ".", ":", "&", "!", and "~". If any of those are present, then it's some sort of abbreviation and is handled specially; otherwise it's a symbol.

You can search in ac.scm for "ssyntax" to see how things are implemented. You can experiment using "ssexpand".

Usefulness... Saves typing, right? If you want to see the 5th element of a list, you could type fred.5 or (fred 5) Seems natural for strings, tables, etc.

Same for ":". We all know the classical abbreviations like "cadr" and "cddr", but we can also gen up new ones like car:cdr:cdr:cdr:cdr which yields a function like caddddr that we can pass around in a 1st-class way.