[clean-list] Beginner
Philippos Apolinarius
phi500ac@yahoo.ca
Sun, 27 Jun 2004 14:27:58 -0400 (EDT)
--0-1148593219-1088360878=:80529
Content-Type: text/plain; charset=us-ascii
Dear members.
I have finished Middle School at Mount Logan Middle. I am learning functions, algebra etc. Next fall I will start High School, and will take Geometry and Calculus. I got C+ in Algebra, which is not a very good Grade, but I can assure you that not many people got even that result. In any case, I believe I need to improve my GPA. I thought it would be great to learn a functional language in order to grasp the concept of function. What do you people think? My adviser, Mr. Dewey, thinks it may help, but he teaches history, and do not know a great deal about Math. Anyway I installed Clean in my machine, and GHC too. I tried a very simple problem to begin with, i.e., to draw a parabola. Plotting is required in Math, which dictated the choice of the starting problem. First in Clean:
module par
import StdEnv,StdIO
Start w = startIO SDI 0 openit
[ProcessClose closeProcess] w
winp = Window "Parabola" NilLS
[WindowLook True drawit]
openit p= pst
where
(error, pst) = openWindow 1 winp p
drawit x y pic= parabola 30 pic
dot= {oval_rx= 5, oval_ry= 5}
parabola 0 pic = pic
parabola i pic = parabola (i-1) p
where
p= drawAt d dot pic
d= {x=i*10+100, y= 400-i*i}
The fact is that I was not able to do the same problem in Haskell, in order to compare the two languages. It seems that Haskell is much more difficult to grasp, and I would welcome any help from people in this list that know Haskell. How do I plot something in Haskell? I am using GHC binaries for window, as it comes out of the box. Another question, I compiled the "Hello World" program that comes in the Haskell user guide, both in Haskell and Clean. Here is it in Clean:
module main
import StdEnv
Start w
# (console, w)= stdio w
= fwrites "Hello, World!\n" console
Here is it in Haskell:
main = putStr "Hello, world!\n"
I compiled both examples. Clean generated a small exec (43 k), as I would expect for this simple problem. Haskell generated a huge exec, ten times larger than Clean. Again, I think the problem is my lack of knowledge about GHC compiler. You must understand that I have been playing with them languages for only two days. My questions are:
1- How to compile the simple examples in Haskell in order to get small exec.
2- How to translate the parabola example to Haskell.
Only after doing that I can decide which language is better for learning about functions. You may ask me why not go to a Haskell list. I may. However, lists usually send a lot of mail, and I want to keep my folder lean.
---------------------------------
Post your free ad now! Yahoo! Canada Personals
--0-1148593219-1088360878=:80529
Content-Type: text/html; charset=us-ascii
<DIV>Dear members.<BR>I have finished Middle School at Mount Logan Middle. I am learning functions, algebra etc. Next fall I will start High School, and will take Geometry and Calculus. I got C+ in Algebra, which is not a very good Grade, but I can assure you that not many people got even that result. In any case, I believe I need to improve my GPA. I thought it would be great to learn a functional language in order to grasp the concept of function. What do you people think? My adviser, Mr. Dewey, thinks it may help, but he teaches history, and do not know a great deal about Math. Anyway I installed Clean in my machine, and GHC too. I tried a very simple problem to begin with, i.e., to draw a parabola. Plotting is required in Math, which dictated the choice of the starting problem. First in Clean:</DIV>
<DIV>module par<BR>import StdEnv,StdIO</DIV>
<DIV>Start w = startIO SDI 0 openit <BR> [ProcessClose closeProcess] w</DIV>
<DIV>winp = Window "Parabola" NilLS <BR> [WindowLook True drawit]</DIV>
<DIV>openit p= pst<BR>where<BR> (error, pst) = openWindow 1 winp p</DIV>
<DIV>drawit x y pic= parabola 30 pic</DIV>
<DIV>dot= {oval_rx= 5, oval_ry= 5}</DIV>
<DIV>parabola 0 pic = pic <BR>parabola i pic = parabola (i-1) p<BR>where<BR> p= drawAt d dot pic<BR> d= {x=i*10+100, y= 400-i*i}<BR> <BR>The fact is that I was not able to do the same problem in Haskell, in order to compare the two languages. It seems that Haskell is much more difficult to grasp, and I would welcome any help from people in this list that know Haskell. How do I plot something in Haskell? I am using GHC binaries for window, as it comes out of the box. Another question, I compiled the "Hello World" program that comes in the Haskell user guide, both in Haskell and Clean. Here is it in Clean:</DIV>
<DIV>module main<BR>import StdEnv</DIV>
<DIV>Start w<BR> # (console, w)= stdio w<BR> = fwrites "Hello, World!\n" console<BR> <BR>Here is it in Haskell:</DIV>
<DIV>main = putStr "Hello, world!\n"</DIV>
<DIV>I compiled both examples. Clean generated a small exec (43 k), as I would expect for this simple problem. Haskell generated a huge exec, ten times larger than Clean. Again, I think the problem is my lack of knowledge about GHC compiler. You must understand that I have been playing with them languages for only two days. My questions are:</DIV>
<DIV>1- How to compile the simple examples in Haskell in order to get small exec.<BR>2- How to translate the parabola example to Haskell.</DIV>
<DIV>Only after doing that I can decide which language is better for learning about functions. You may ask me why not go to a Haskell list. I may. However, lists usually send a lot of mail, and I want to keep my folder lean.</DIV><p><br><hr size=1>Post your free ad now! <a href="http://ca.personals.yahoo.com/"><b>Yahoo! Canada Personals</b></a><br>
--0-1148593219-1088360878=:80529--