[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] Legacy caar to cddddr
Alex Shinn scripsit:
> > SECOND, THIRD, LIST-TAIL, etc., very much lack the elegance and
> > conciseness of the C*R notation. For example, should the argument
> > of LIST-TAIL should be 3 or 4?
> So you're saying you can count the number of d's faster than you can
> read the character 3 or 4?
No, I think he is saying that he can't remember if LIST-TAIL is
zero-based or one-based. I have no trouble remembering that it's
zero-based, just like *-REF, but to each their own brain farts.
> > Another example shows their use in small graph structures: e.g., in
> > CDADADR, the list of symbols DADAD describes a descent path in a
> > binary tree at a glance.
> I'm actually not concerned so much whether you call it `cadr' and
> `caddr' or `second' and `third', but this I find disturbing. `cdadadr'
> means nothing to me, and looks likely to throw inscrutable error
> messages when used incorrectly.
It means nothing to me either when applied to a list containing other
lists (and so on). But when thinking of a structure of pairs in terms
of a binary tree, it makes complete sense: right-left-right-left-right
and there you are. As a matter of style, then, I would use the C*R
functions when dealing with trees, but not with lists.
> This reminds me of Forth programmers insisting that they're used to
> stack operations, and it takes no effort at all to keep track of the
> stack in their head. I believe them.
Indeed, which is why I've had no trouble implementing two Forth-like
systems but can't program in them to save my life.
John Cowan cowan@x http://ccil.org/~cowan
I am he that buries his friends alive and drowns them and draws them
alive again from the water. I came from the end of a bag, but no bag
went over me. I am the friend of bears and the guest of eagles. I am
Ringwinner and Luckwearer; and I am Barrel-rider. --Bilbo to Smaug
Scheme-reports mailing list