[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Greetings



"Paul Steckler" <steck@ccs.neu.edu> writes:

> > If anyone could explain what I've done wrong to warrent this warning,
> > I'd be very thankful.
> 
> The problem is that `cur' might be an empty list, in which case
> `car' would fail; the inferred type of `cur' is (listof sym), which
> includes the empty list.  If your loop had a test for null?,
> MrSpidey might be able to do better.


Isn't that just a theoretical problem?  As far as I can tell
there is no possible way for an empty list to ever be bound to cur.

I was under the impression that Mr. Spidy would report on problems
that it saw possible paths that could actually happen. 

It's been pointed out that the problem is with my "length"
counter, which was an attempt at optimization to reduce the number of
recursions when it could calculate the fact that there isn't enough
"available" items to possibly create another answer.

(I wasn't using it as an index, but rather a way of knowing that if we
want 'n' items from a list of length m, that we don't keep searching
in list m if it doesn't have enough items in the first place.  I
didn't want to just stop on an empty list, but also on a non-empty
list that was too small.)

Thanks to everyone for their feedback.  I'm going to investigate some
of the suggested alternate implementations.

-- 
Chris