[clean-list] Help Please: Beginner to Clean.. Console I/O
RT Happe
rthappe at web.de
Fri May 6 00:43:27 MEST 2011
Khurram Khan wrote:
> We think that writing small programs in the form that you also suggested is pretty straight forward and we have got a good grasp of it.
> However, our real problems started once we started going through Chapter 5, which has examples relating I/0 in "hello1" and "hello2".
Well, your questions on hello1 made me think that you didn't quite understand stuff like this:
module foo
import StdEnv
f x y = (y,x+y)
Start :: Int
Start
# (v,w) = f 0 1
# (v,w) = f v w
# (r,s) = f v w
# (_,t) = f r s
= t
Which made a step back to previous lessons seem advisable.
> we have a general feeling among our class that nobody is getting a hang of I/O operations in Clean, so we assume that it is not as straight-forward as it is in C++, but it would be excellent if we can learn it.
Indeed, the requirement to program actions (that change things / have an effect) explicitly as state transformers makes I/O somewhat awkward.
> we need some help from someone to show us how it could be done, and from there we should be able to write more complicated programs ourselves.
I do hope that Isaac Gouy's Clean vs. C++ examples will see you through your I/O predicament.
> at this point of time we are more interested in learning how I/O operations are performed, because at some point you do need input from the user for a program to be useful/interactive, and it is also a vital part of our academic assignment.
I certainly agree that reality and, in particular, users are a constant annoyance.
Regards, rt
More information about the clean-list
mailing list