[Haskell-cafe] beginner's problem about lists

2006-10-10 Thread falseep
Hi all,I'm trying to implement a function that returns the shorter one oftwo given lists,something likeshorter :: [a] - [a] - [a]suchthat shorter [1..10] [1..5] returns [1..5],and it's okay for shorter [1..5] [2..6] to return either. Simple, right?However, it becomes difficult when dealing

Re: [Haskell-cafe] beginner's problem about lists

2006-10-10 Thread falseep
Thanks for your reply. I tried afew ways butnoneworked.One islike: shorter as bs = f id id as bs wheref ca cb [] _ =ca[] f ca cb _ [] = cb []f ca cb (a:as) (b:bs) = f (ca.(a:)) (cb.(b:)) as bs However this will result in a non-terminating loop for shorter [1..]