Re: [Haskell-cafe] Java or C to Haskell

2006-09-20 Thread Carajillu
Yes, they must be equal the whole way, I like this recursive solution :) Ketil Malde-3 wrote: > > Carajillu <[EMAIL PROTECTED]> writes: > >> compare function just compares the two lists and return true if they are >> equal, or false if they are not. > &g

Re: [Haskell-cafe] Java or C to Haskell

2006-09-20 Thread Carajillu
That works good, but I have a problem with the return type, I forgot to mention... can it be a [char]?? Donald Bruce Stewart wrote: > > 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

Re: [Haskell-cafe] Java or C to Haskell

2006-09-20 Thread Carajillu
wow, the simpliest ever! Andrea Rossato wrote: > > On Wed, Sep 20, 2006 at 01:31:22AM -0700, Carajillu wrote: >> 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

[Haskell-cafe] Java or C to Haskell

2006-09-20 Thread Carajillu
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(

Re: [Haskell-cafe] Problems interpreting

2006-09-18 Thread Carajillu
Definitely I'll take this solution, I'm reading about Pointfree, I think it's not that dificult to understand. And moreover it's the simpliest way to write code. Jón Fairbairn-2 wrote: > > Andrea Rossato <[EMAIL PROTECTED]> writes: > >> On Mon, Se

Re: [Haskell-cafe] Problems interpreting

2006-09-18 Thread Carajillu
Not a good solution, it just substitutes the first occurrence of the item in the list. I'll try the others Carajillu wrote: > > Finally I took Andrea's solution "check_elem (x:xs) = if x == e then (l2 > ++ xs) else [x] ++ check_elem xs" > I think it's e

Re: [Haskell-cafe] Problems interpreting

2006-09-18 Thread Carajillu
Finally I took Andrea's solution "check_elem (x:xs) = if x == e then (l2 ++ xs) else [x] ++ check_elem xs" I think it's easy to understand for me ( in my noob level), than the recursive one. I'm testing it and it's working really well. The other solutions are a little complicated for me, but I'm

Re: [Haskell-cafe] Problems interpreting

2006-09-18 Thread Carajillu
Wow! I'm starting to love this languaje, and the people who uses it!:) Andrea Rossato wrote: > > On Mon, Sep 18, 2006 at 12:54:34PM +0200, Albert Crespi wrote: >> Thank you very much for your reply! >> As I said, it is my first experience with Haskell, I have been >> programming >> in Java and

[Haskell-cafe] Problems interpreting

2006-09-18 Thread Carajillu
Hi, I'm a student and I have to do a program with Haskell. This is the first time I use this languaje, and I'm having problems with the indentation. I want to check if this function is correct, but when I try to make the GHCi interpret it, I get "line 18:parse error (possibly incorrect indentation