
On Fri, 4 Mar 2005, Sam G. wrote:
Thaks a lot for your contribution, this helps me a lot, I see what I've got to do. However, I understand the first version (Stack.hs), but I can't get what StateM.hs is. Is it the same version but using state transformers, so as to be able to do IO (which I would need)? In fact, could you give me a simple example of how to use StackM.hs, a simple
Yes, it is. Perhaps there was a more conventional way to name it.
example that pushes some ints and add the toppest two.
Enclosed is a programme that asks for two ints from standard input, adds them along with a random number from 1 to 10, then prints the answer. I hope that it helps you.
PS: In fact I'm trying to implement a simple RPN "calculator". So at first I need +, push, pop and view which shows the whole list. Attached is what I started to do before I get your mail.
Ah, that's interesting! You've made a good start. Thinking of stacks, I've often wondered if Haskell would be a good language for implementing a PostScript interpreter. All the best, Mark