Arc Forumnew | comments | leaders | submitlogin
4 points by palsecam 5568 days ago | link | parent

About 'last. Conses are a powerful, general data type. One way you could use them is to build another little-less-general data type, a subset of them, a "list", where (list 'a 'b 'c) is (cons 'a (cons 'b (cons 'c nil))).

Then you define some functions to operate (exclusively) on this new "data type", and 'last is one of them. Exclusively: (last (cons 'a 'b)) doesn't work, because it'd have no meaning to use 'last here. '(a . b) is not a list, just a cons.

Similarly, one way you could use lists is to build a-little-less-general abstraction, association lists. Then you define 'alref/etc. to use with this new data type. But (alref (list 'a 'b 'c) 'a) doesn't work, since it has no meaning in this context.

But 'car/'cdr, they operate on raw conses, not only on lists. And I said before, IMHO, 'rest is not good, because you're assuming by using this name that it is an operator for lists only. Yes, (rest '(a . b)) would work, but its meaning is crappy here (IMHO).

But you're making an interesting point. Maybe 'rest/'first should be also included, as synonyms for 'cdr/'car because actually people almost always use 'car/'cdr when working with lists, and in list context, their meaning may be easier to understand. But this is another debate.

---

About the meaning of 'car. Sure, if you're programming in one of the current dialects of Lisp, you have some basic notions of English, even if you're Chinese. Yet, when reading some Lisp code, if I see 'car I just know it means "first halve of the pair". I mean, before you pointed out that "car" means "a vehicle" most of the time, I didn't ever think about this (valid) point when reading/writing Lisp code. That's why I don't see it as a problem.

I don't know, I suppose it's because the context is important. When I see 'map in a Lisp file, I don't think about a (geographical) map. When I see 'cons I know it's not as in "pros & cons". When I see 'table, I know it's not about a dining table. When I type `cd' in my shell, I know it means "change directory" and not "compact disc", etc.

Yes, if you ask a random guy in the street what "car" means he'll answer you "a vehicle" and not "the first halve of the pair". But it's the same problem if you ask it what "cd" or "table" means. There are ton of issues like this, even in natural languages. For instance, homonyms: a tire is both a car wheel and the feeling of fatigue.

---

About language adoption. It seems pg knows it is important: So whether or not a language has to be good to be popular, I think a language has to be popular to be good. And it has to stay popular to stay good. (http://paulgraham.com/popular.html)

OTOH, remember Arc is made for "hackers" and to be adopted by "hackers" (at least at first). And there is the "100 years" idea (i.e: no rush in adoption may not be a problem). So maybe pg's idea of "language adoption" is not the same than yours ;-)

---

> (Edit - Opps - I just realized we will not)

Funny yet true one :-)

I always felt a little uncomfortable about the "100 years" idea. I keep saying to myself it's just a catch phrase for a decent goal, trying to design something timeless. But still, it also reminds me of "I intend to set up a thousand-year Reich and anyone who supports me in this battle is a fellow-fighter for a unique spiritual — I would say divine — creation". You know, the fooliness to not want to live in the current, real, impure world.



1 point by thaddeus 5568 days ago | link

> "I don't know, I suppose it's because the context is important. When I see 'map in a Lisp file, I don't think about a (geographical) map. When I see 'cons I know it's not as in "pros & cons". When I see 'table, I know it's not about a dining table. When I type `cd' in my shell, I know it means "change directory" and not "compact disc", etc"

Absolutely and it's "because the context is important" that I made the suggestion. I don't really care that it's called "car". I'm just suggesting that IF you're going to have a function called "last" why wouldn't you create "first", as the user will intuitively try to use it given that last exists.

:)

-----

1 point by conanite 5564 days ago | link

You make a powerful point about cons cells being a more fundamental type than lists. I think if we really wanted english language words to describe the parts of a cons, "left" and "right" would be appropriate for what a cons is in isolation, but would unfortunately be meaningful only if you're using conses to represent binary trees. The beauty of a cons is that it's the smallest possible structure out of which one can build arbitrarily larger composites. And I'm not sure how valuable metaphors from the physical world are when contemplating abstractions - a cons is another degree removed from everyday reality than windows, buttons, dialogs, tabs, and menus are.

-----