[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell-cafe
Subject:    Re: (no subject)
From:       Shlomi Fish <shlomif () vipe ! technion ! ac ! il>
Date:       2001-03-28 4:36:14
Message-ID: Pine.LNX.4.10.10103280623370.21032-100000 () vipe ! technion ! ac ! il
[Download RAW message or body]

On Tue, 27 Mar 2001, Atenea Azcue wrote:

> 
> Hello 
> 
> My name is Atenea .  I just want to ask you that how can i Creat a program 
> that just say "hello word" and another that can add a "matrix" if you
> can
>help me I would really going to apreciate please.  Thank you for your
> listening 
> 

It depends if your matrix is represented as a list of lists or a
two-dimensional array. For lists it is something like that:



plus (a,b) = a+b
plus_vec ([],[]) = []
plus_vec (a:as,b:bs) = (plus (a,b)):(plus_vec (as,bs))
vector_add a b = (map plus (zip a b))
matrix_add a b = (map plus_vec (zip a b))


It can be done a bit better using classes, but then it will be less easy
to understand.

For 2-D arrays, I believe there is an example in the tutorial that shows
matrix _mulitplication_, so addition should be quite trivial after
understanding that.

Check out: http://www.haskell.org/tutorial/

Regards,

	Shlomi Fish

> 
> 
> ---------------------------------
> Do You Yahoo!?
> Yahoo! Mail Personal Address - Get email at your own domain with Yahoo! Mail.



----------------------------------------------------------------------
Shlomi Fish        shlomif@vipe.technion.ac.il 
Home Page:         http://t2.technion.ac.il/~shlomif/
Home E-mail:       shlomif@techie.com

The prefix "God Said" has the extraordinary logical property of 
converting any statement that follows it into a true one.



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic