Re: [Scheme-reports] Appeal for review help with R7RS draft 4 Denis Washington (15 Oct 2011 07:14 UTC)
Re: [Scheme-reports] Appeal for review help with R7RS draft 4 Jeronimo Pellegrini (15 Oct 2011 12:06 UTC)
Re: Appeal for review help with R7RS draft 4 Arthur A. Gleckler (16 Oct 2011 04:46 UTC)
Re: Appeal for review help with R7RS draft 4 Arthur A. Gleckler (16 Oct 2011 21:08 UTC)
Re: Appeal for review help with R7RS draft 4 Arthur A. Gleckler (17 Oct 2011 06:27 UTC)
[Scheme-reports] Legacy caar to cddddr Jussi Piitulainen (16 Oct 2011 14:45 UTC)
Re: [Scheme-reports] Legacy caar to cddddr John Cowan (17 Oct 2011 06:41 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Alex Shinn (17 Oct 2011 23:39 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Jussi Piitulainen (20 Oct 2011 12:12 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Ray Dillinger (25 Oct 2011 00:43 UTC)
Re: [Scheme-reports] Legacy caar to cddddr John Cowan (25 Oct 2011 02:17 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Alex Shinn (20 Oct 2011 08:21 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Ray Dillinger (20 Oct 2011 17:06 UTC)
Re: [Scheme-reports] Legacy caar to cddddr John Cowan (20 Oct 2011 17:46 UTC)
Re: Legacy caar to cddddr Arthur A. Gleckler (20 Oct 2011 17:50 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Aubrey Jaffer (20 Oct 2011 20:18 UTC)
Re: [Scheme-reports] Legacy caar to cddddr John Cowan (20 Oct 2011 22:44 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Alex Shinn (21 Oct 2011 02:48 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Aubrey Jaffer (22 Oct 2011 00:04 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Alex Shinn (23 Oct 2011 05:27 UTC)
Re: [Scheme-reports] Legacy caar to cddddr John Cowan (20 Oct 2011 17:52 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Grant Rettke (21 Oct 2011 02:34 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Alex Shinn (21 Oct 2011 02:51 UTC)
Re: [Scheme-reports] Legacy caar to cddddr John Cowan (21 Oct 2011 02:56 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Grant Rettke (21 Oct 2011 20:16 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Aubrey Jaffer (22 Oct 2011 00:14 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Andre van Tonder (22 Oct 2011 14:47 UTC)
Re: [Scheme-reports] Legacy caar to cddddr John Cowan (22 Oct 2011 17:56 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Andre van Tonder (22 Oct 2011 19:15 UTC)
Re: [Scheme-reports] Legacy caar to cddddr John Cowan (22 Oct 2011 20:31 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Andre van Tonder (23 Oct 2011 08:11 UTC)
Re: [Scheme-reports] Legacy caar to cddddr John Cowan (23 Oct 2011 19:41 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Denis Washington (22 Oct 2011 19:16 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Aubrey Jaffer (24 Oct 2011 00:57 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Alex Shinn (23 Oct 2011 05:39 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Andre van Tonder (23 Oct 2011 08:04 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Jussi Piitulainen (23 Oct 2011 11:44 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Alex Shinn (23 Oct 2011 15:16 UTC)
Re: [Scheme-reports] Legacy caar to cddddr Andre van Tonder (23 Oct 2011 16:27 UTC)
Re: [Scheme-reports] Legacy caar to cddddr John Cowan (23 Oct 2011 18:14 UTC)

Re: [Scheme-reports] Legacy caar to cddddr Andre van Tonder 23 Oct 2011 08:04 UTC

On Sun, 23 Oct 2011, Alex Shinn wrote:

> On Sat, Oct 22, 2011 at 11:46 PM, Andre van Tonder <andre@het.brown.edu> wrote:
>> On Fri, 21 Oct 2011, Aubrey Jaffer wrote:

>>> C*R procedures are very useful in symbolic algebra, for graphs and
>>> trees, and for manipulating programs (such as compiling).  Claims of
>>> their demise are premature.
>>
>> I agree.  I have found them useful for manipulating programs.  Once you are
>> used to them, you can see at a glance what they are doing (just like with
>> CAR and CDR).
>>
>> Here is an example of their use in a renaming-style macro (as WG2 promises
>> us we will have).  Used here are CAR, CDR, CADR, CDDR, CADDR, and CDDDR.
>>  All these are used in a completely obvious and transparent way.  This is
>> not a "code smell".
>
> Personally I think it is.  `cadr' is `second' and `caddr' is `third',
> which makes things clearer, and `cdddr' is (list-tail ls 3) or
> maybe `third-tail'.

Maybe for a virgin programmer, but they don't make things clearer to someone
who is used to the C*R deconstructors (e.g., anyone familiar with Scheme or
LISP).  Anyone who has programmed macros in this style knows that every
additional argument in the descent simply needs another D, etc.
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?  I would have to look it up every single time, and invariably
I count wrong.  CDDDR I can just do in my mind in a second, and I know that to
get REST arguments I just replace the last CA#R in my descent with CD#R.  Also
lost is the nice algebra of the letters internal to C*R - for example if I
changed the syntax of the macro example by inserting a new parameter all I
would need to do to everything after that element is to insert an additional D
before the R - it is MUCH cleaner and less work to change CADR to CADDR, CADDR
to CADDDR, than the more awkward changing of SECOND to
THIRD and THIRD to FOURTH, etc.

Finally, you have the elegant algebra (CXYR z) = (CXR (CYR z)) where X and Y are
strings of As and Ds.  What elegant algebra do THIRD, SECOND, and LIST-TAIL
satisfy?

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.

_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports