Arc Forumnew | comments | leaders | submitlogin
1 point by rkts 5451 days ago | link | parent

They're short, but they don't look nice.

I find code easier to read when the names are easily spoken aloud. In the language I'm working on (nothing serious) all the common names are either English words or things that look like English words. I also favor short words over long words and Germanic words over Latin words, and I avoid abbreviations as much as possible (except in local variables, which are usually single letters). It helps me a lot.

As to car/cdr specifically, though, I think the best option is pattern matching.



2 points by krg 5445 days ago | link

Well, cdr can't really be spoken aloud unless you make up a way to pronounce it (which of course people do). And you could do the same for hp, rp, and the rest... adding an "o" sound gives some nice words, like hop, top, and fop. Kind of a Dr. Suess feel. :)

-----

1 point by anarcer 5451 days ago | link

Yes, but IMHO they are omogeneous with the other abbrevs in Arc sintax and are also conceptually clearer than car/cdr (that refer to old registers of an old pc): for example, hp (head of pair), tp (tail of pair) and hthtp (head tail head tail of pair) may help conceptual visualization...

-----

2 points by anarcer 5444 days ago | link

Can anybody tell me where I could find discussion about this topic?

BTW, just to complete my previous example:

!hp for set-car !tp for set-cdr ?hp and similar for predicates...

-----