Arc Forumnew | comments | leaders | submitlogin
4 points by shader 2506 days ago | link | parent

I'm having a hard time finding any documentation on ssyntax either. Must have been in some early forum posts... But your understanding is the same as mine.

For a little more background, the "." symbol is traditional Lisp syntax for a single cons cell. So (1 . 2) is a cons cell with car containing 1 and cdr containing 2. This is in contrast to the list '(1 2), which expands to two cons cells: (1 . (2 . nil)).

Cons cell notation is often used for pairs, such as k/v pairs in a hash table, since you don't need the ability to append additional content.

pg added "a.b" as "symbol syntax" to arc to provide shorthand for (a b), which is a very common pattern - calling a single argument function, looking something up in a table, etc. Furthermore, it chains, so "a.b.c" expands to ((a b) c) - the pattern you would want if you were going to look something up in a nested set of objects.

And as zck points out, symbols (quoted names) are very common keys for object, since they are perfect for literal names. In fact, that's precisely how templates are used to make something analogous to classes in arc.

https://arclanguage.github.io/ref/template.html

(and yes, you two probably know this, but hopefully it's useful for somebody)

I'll keep looking for explanations of ssyntax though.