On Tue, 2007-04-17 at 10:22 -0700, Richard Fateman wrote:
> if I am looking at the right piece of email,
> sublist(x):= block([l: [], prev: x[1]], for i:2 thru length(x) do
> (if prev*x[i] > 0 then l: cons(prev,l), prev:x[i]), reverse(l));
>
> what you do here is you take a list x, and for each value of i, you start at the beginning of the list and count out i items. Twice. So if x is of length n, you do n^2 work, just finding the elements.
>
> stepping through the list taking successive "rest" parts would take linear work.
Oh, that's what x[i] does? steps through the list from 1 to i? I'm
really not used to lisp yet, even after having written several lines of
code. Thank you for your very clear explanation.
Regards,
Jaime