On Wed, Nov 20, 2013 at 12:09 PM, Bo Gus <[email protected]> wrote:
> My tail recursive implementation of length is like this:
>
> (define (length2 l)
>   (define (l-iter l count)
>     (if (null? 1) count
>         (l-iter (cdr l) (+ count 1))))
>   (l-iter l 0))

> I am fairly new to scheme.  What am I doing wrong?

You wrote (null? 1), which is always false.  Note 1 instead of l.

Cheers
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to