(no subject)

Shlomi Fish shlomif@vipe.technion.ac.il
Wed, 28 Mar 2001 06:36:14 +0200 (IST)


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.