Recursion over lists
Philippa Cowderoy
flippa at flippac.org
Mon Feb 18 10:39:16 EST 2008
On Mon, 18 Feb 2008, TOPE KAREM wrote:
> Hello everyone,
>
> I am just learning to program in Haskell, and I found recursion very
> interesting.
> However, I need to write a recursive function over two lists.
>
> The function must check the elements in the two lists and return an
> element that is common to both lists if there is any.
>
> Any assistance would be appreciated.
>
Imagine for a moment that instead of "two lists" you have "a pair of
lists", and thus each time you recurse you must generate a new pair of
lists. After that it should be more or less business as usual if you're
comfortable working on one list.
--
flippa at flippac.org
There is no magic bullet. There are, however, plenty of bullets that
magically home in on feet when not used in exactly the right circumstances.
More information about the Glasgow-haskell-users
mailing list