On Wed, Sep 20, 2006 at 01:31:22AM -0700, Carajillu wrote:
> 
> I'm trying to write in Haskell a function that in Java would be something
> like this:
> 
> char find_match (char[] l1, char[] l2, char e){
>       //l1 and l2 are not empty
>       int i = 0;
>       while (l2){
>               char aux = l2[i];
>               char[n] laux = l2;
>               while(laux){
>                       int j = 0;
>                       if(laux[j] = aux) laux[j] = e;
>                               j++;
>               }
>               if compare (l1, laux) return aux;
>               else i++;
>       }
> return '';
> }
> 
> compare function just compares the two lists and return true if they are
> equal, or false if they are not.


I know that this is far too simple. But I'm simple minded:

comp [] [] = True
comp (x:xs) (y:ys) = if x == y then comp xs ys else False

andrea
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to