Re: newbie exploring better ways



Look at it this way, there are three things that can happen when you
call this function:

If the list is empty, return the list.

If the car of the list is equal to the item, return the cdr of the
list

Else cons the car of the list with the result of calling the function
with the cdr of the list

How would that look in Lisp?

Which do you like better?
.



Relevant Pages

  • Re: Python syntax in Lisp and Scheme
    ... >> rest instead of car and cdr, ... >> of a list and cdr means the rest. ... Now that's a solid engineering reason! ... > (I'm not knocking Lisp; in fact, this discussion has whetted my appetite to ...
    (comp.lang.python)
  • Re: Python syntax in Lisp and Scheme
    ... >> rest instead of car and cdr, ... >> of a list and cdr means the rest. ... Now that's a solid engineering reason! ... > (I'm not knocking Lisp; in fact, this discussion has whetted my appetite to ...
    (comp.lang.lisp)
  • Re: Lisp in hardware
    ... any definition of CDR is meaningless ... Mark> without a prior definition of CAR. ... and other features that make it, not accidently, well suited for Lisp. ...
    (comp.lang.lisp)
  • Re: Yet another newB attempting a scheme alg...
    ... R5RS says that it is "an error" to take the car and cdr of an empty ...
    (comp.lang.scheme)
  • Re: Python syntax in Lisp and Scheme
    ... On Thu, 9 Oct 2003, Andrew Dalke wrote: ... > It has sometimes been said that Lisp should use first and ... > rest instead of car and cdr, ... > of a list and cdr means the rest. ...
    (comp.lang.python)