dons:
> crespi.albert:
> > 
> > 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 '';
> > }
> 
> Yikes!
> 
> > 
> > compare function just compares the two lists and return true if they are
> > equal, or false if they are not.
> > it is really a simple function, but I've been thinking about it a lot of
> > time and I can't get the goal. It works like this:
> > 
> > find_match "4*h&a" "4*5&a" 'h' ----> returns '5' (5 matches with the h)
> > find_match "4*n&s" "4dhnn" "k" ----> returns ''  (no match at all - lists
> > are different anyway)
> 
> That's almost a spec there :)

Ah, I see I misread the spec :) Time for some tea.

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

Reply via email to