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;
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 been thinking about it a lot
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 e){
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.
find_match 4*ha 4*5a 'h' returns '5' (5
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
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 C for
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
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 easy to understand for me ( in my noob level
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, Sep 18, 2006 at 04:16:55AM -0700, Carajillu wrote