Thread View: comp.lang.functional
1 messages
1 total messages
Started by Junxian J Liu
Tue, 21 Jul 1992 15:58
Re: Questions on converting Miranda code to Haskell
Author: Junxian J Liu
Date: Tue, 21 Jul 1992 15:58
Date: Tue, 21 Jul 1992 15:58
35 lines
1455 bytes
1455 bytes
The character '>' appeared at the first column of my original
message was automatically converted to '|' somehow (I don't know
why). I list the Miranda code here again (leave first coulmn
blank):
> ns = map numval (lines (read "data"))
> n = # ns
> sqrts = map sqrt ns
> sum_sqrts = sum sqrts
> avg_sqrts = sum_sqrts / n
> men_sqrts = sum (map minus_avg_sqr sqrts) / n
> where
> minus_avg_sqr x = (x - avg_sqrts) * (x - avg_sqrts)
> result = "number of values = " ++ show n ++ "\n"
> ++ "sum_sqrts = " ++ show sum_sqrts ++ "\n"
> ++ "avg_sqrts = " ++ show avg_sqrts ++ "\n"
> ++ "men_sqrts = " ++ show men_sqrts ++ "\n"
> main = [Stdout result]
Sorry about this.
Liu.
-------
Dr J Liu, Department of Computing, Imperial College,
180 Queens Gate, London SW7 2BZ, United Kingdom.
Telephone : (+44 71/071) 589 5111 ext. 5033 Fax : (+44 71/071) 581 8024
Email: jjl@doc.ic.ac.uk
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads