Re: Car and cdr (Re: Python syntax in Lisp and Scheme)
From: Pascal Bourguignon (spam_at_thalassa.informatimago.com)
Date: 10/13/03
- Next message: Tayss: "Re: 64-bit G5?"
- Previous message: Jon S. Anthony: "Re: Python syntax in Lisp and Scheme"
- In reply to: Pascal Costanza: "Re: Car and cdr (Re: Python syntax in Lisp and Scheme)"
- Next in thread: Pascal Costanza: "Re: Car and cdr (Re: Python syntax in Lisp and Scheme)"
- Reply: Pascal Costanza: "Re: Car and cdr (Re: Python syntax in Lisp and Scheme)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
- Next message: Tayss: "Re: 64-bit G5?"
- Previous message: Jon S. Anthony: "Re: Python syntax in Lisp and Scheme"
- In reply to: Pascal Costanza: "Re: Car and cdr (Re: Python syntax in Lisp and Scheme)"
- Next in thread: Pascal Costanza: "Re: Car and cdr (Re: Python syntax in Lisp and Scheme)"
- Reply: Pascal Costanza: "Re: Car and cdr (Re: Python syntax in Lisp and Scheme)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|