Re: Car and cdr (Re: Python syntax in Lisp and Scheme)

From: Pascal Bourguignon (spam_at_thalassa.informatimago.com)
Date: 10/13/03


Date: 13 Oct 2003 18:39:38 +0200


Pascal Costanza <costanza@web.de> writes:
> >>>"left" and "right" - referring to 'subtrees'?
> >>
> >>Sure, why not?
> >>
> >>(defun left (tree)
> >> (car tree))
> >>
> >>(defun right (tree)
> >> (cdr tree))
> >>
> >>;-)
> > Wrong:
> > (defun left (tree) (car (car tree)))
> > (defun right (tree) (cdr (car tree)))
> > (defun label (tree) (cdr tree))
>
> I see your point, but "wrong" is a bit strong here:

This was a rhetorical "wrong" :-)
 
> (defvar *tree-labels* (make-hash-table))
>
> (defun label (tree) (gethash tree *tree-labels*))

While this kind of technique may be helpful (or even save our "life"
sometimes), I don't like it because of the loose coupling and possible
inconsistency between the various data structures... I think it can
only be justified by low-level optimization reasons.

-- 
__Pascal_Bourguignon__
http://www.informatimago.com/
Do not adjust your mind, there is a fault in reality.


Relevant Pages

  • Re: recommendations for night and landscape photography?
    ... intention of eating offal, and there are those of us who never shot ... Nor was it intended to mean anything other than I think it is an intellectual mistake to limit your art, or appreciation of it because of the technique used. ... But if you can overcome a physical limitation, such as exposure range, through use of a technique, I see no reason to ban its use. ... Of course I have limitations in my life. ...
    (alt.photography)
  • Re: OT: Gypsies
    ... Using the patented Mavis Beacon "Hunt&Peck" Technique, ... up at the side of the road and was then gobsmacked to see a proper ... horse-drawn gypsy caravan. ... I had no idea that that way of life still survived, ...
    (uk.rec.motorcycles)
  • Re: Its official
    ... Using the patented Mavis Beacon "Hunt&Peck" Technique, steve robinson typed ... one woman in my life is enough (although im not>saying shes not ...
    (uk.rec.motorcycles)
  • Re: Good lad
    ... Using the patented Mavis Beacon "Hunt&Peck" Technique, ... >>>>>The day we don't care that another human being has died is the ... >>>But we must value life and hold it precious. ...
    (uk.rec.motorcycles)
  • Re: OT :They told me he was bad.................
    ... Using the patented Mavis Beacon "Hunt&Peck" Technique, Speedgazebo typed ... faces between 15 years and life in prison.' ... Wicked Uncle Nigel - "He's hopeless, ...
    (uk.rec.motorcycles)