[racket] can't cdr list from dotted-tail notation?
On Tue, Nov 20, 2012 at 10:46 PM, Sanjeev K Sharma <throwit1 at hotmail.com> wrote:
> I already spent a couple of hours on this, hope I am not missing something really obvious - does the dotted notation produce some kind of flat list instead of cons cells?
>
>
>
> (define list-rf (lambda ( n . items )
> (if (= n 0)
> (car items)
> (list-rf (- n 1)(cdr items)))))
change the last line to:
(apply list-rf (- n 1) (cdr items)
In your version, the recursive calls get a one-element list as argument.
Cheers
P.