On Fri, 13 Apr 2007, azn_style_pri
@hotmail.com wrote:
> Hi all,
> I am new to Scheme and currently learning to use DrScheme
> Now I am playing with lists to get the hang of it.
> Ok so what I want to do now is to write a procedure to filter out the
> longest lists in a list,
> for example
> (longest '((1 2 3) (1) (1 2 3 4) (1 2) (2 3 4 5) (1 2 3))) = ((1 2 3
> 4) (2 3 4 5))
> I've written a procedure that compares 2 lists ( list x and list y )
> (longerlist x y), if (length x) > (length y) then returns y, vise
> versa
> if (length x) = (length y) returns both x and y.
> Example :
> (longerlist '(1 2 3) '(4 5 6 7)) = (4 5 6 7)
> (longerlist '(1 2 3 4) '(5 6 7 8)) = ((1 2 3 4) (5 6 7 8))
> I can't really think of any other ways to do the final goal other than
> using (longerlist x y)
> but I am stuck on how to actually use (longerlist) in (longest)
> can someone point me to the right direction?
> If (longerlist) shouldnt be used in (longest) then any other ways to
> approach this?
Theres many ways to do this. Personally I would iterate over the