
I'm going through the "Write Yourself a Scheme in 48 Hours" http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/overview.html tutorial. I like it a lot, but I have some concerns. Are the exercises in the tutorial known to be solvable by mere mortals? For instance: "Rewrite parseNumber using...explicit sequencing with the >>= operator" http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/parser.html#sy... There aren't any examples of using >>= previous to this question. Furthermore, the link to the Standard Prelude is not helpful because there aren't any examples of how to use >>=. Furthermore, consider the exercise: "Change parseNumber to support the Scheme standard for different bases. You may find the readOct and readHex functions useful." http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/parser.html#sy... I struggled against this for a couple hours last night. How is the reader supposed to figure out readOct, which is part of ReadS, without understanding the whole ReadS business? If the reader does understand the ReadS business, he probably already understands Haskell far better than the tutorial seems to suggest. I eventually figured out how to write: parseHexNumber = do char '#' char 'x' s <- many1 (oneOf "0123456789abcdefABCDEF") case readHex s of [(n,"")] -> return n but it was no small feat. Furthermore, it was only possible because I had already spent so much time trying to understand "A Gentle Introduction to Haskell". Worst of all, once I had it all implemented, the parser *from* the tutorial: parseExpr :: Parser LispVal parseExpr = parseAtom <|> parseString <|> parseNumber led to some surprising results. It turns out that "#o9", which should be an invalid attempt at an octal number, is getting parsed as an atom. There's a whole layer of difficulty that seems insurmountable by mere mortals like me using just this tutorial and minimal reference usage. What am I missing? Is it really solvable by mere mortals who don't already know Haskell, the Parsec module, etc.? Thanks, -jj -- http://jjinux.blogspot.com/

Shannon -jj Behrens wrote:
I'm going through the "Write Yourself a Scheme in 48 Hours" http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/overview.html
tutorial. I like it a lot, but I have some concerns. Are the exercises in the tutorial known to be solvable by mere mortals?
The answer seems to be "yes, iff the mortals in question have grasped the basics of monads, so they can fill in the gaps in the exposition."
For instance:
"Rewrite parseNumber using...explicit sequencing with the >>= operator" http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/parser.html#sy...
There aren't any examples of using >>= previous to this question.
There's a peculiar mixture of assumptions in the article. He treats monads breezily, as if they're a given; but pattern matching (much more basic) receives some rather more detailed exposition. And he glosses over ">>", but doesn't mention the rewrite rule from "a<-x" to "x>>=\a->". So don't beat yourself up. The tutorial is missing a few bits and pieces.

On 2/1/07, Bryan O'Sullivan
Shannon -jj Behrens wrote:
I'm going through the "Write Yourself a Scheme in 48 Hours" http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/overview.html
tutorial. I like it a lot, but I have some concerns. Are the exercises in the tutorial known to be solvable by mere mortals?
The answer seems to be "yes, iff the mortals in question have grasped the basics of monads, so they can fill in the gaps in the exposition."
For instance:
"Rewrite parseNumber using...explicit sequencing with the >>= operator" http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/parser.html#sy...
There aren't any examples of using >>= previous to this question.
There's a peculiar mixture of assumptions in the article. He treats monads breezily, as if they're a given; but pattern matching (much more basic) receives some rather more detailed exposition. And he glosses over ">>", but doesn't mention the rewrite rule from "a<-x" to "x>>=\a->".
So don't beat yourself up. The tutorial is missing a few bits and pieces.
Thanks. That's all I needed to hear :) -- http://jjinux.blogspot.com/

See for examples of the usage of >>= "A tour of the Haskell monad
functions", URL:
members.chello.nl/hjgtuyl/tourdemonad.html
On Fri, 02 Feb 2007 01:31:36 +0100, Shannon -jj Behrens
I'm going through the "Write Yourself a Scheme in 48 Hours" http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/overview.html tutorial. I like it a lot, but I have some concerns. Are the exercises in the tutorial known to be solvable by mere mortals?
For instance:
"Rewrite parseNumber using...explicit sequencing with the >>= operator" http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/parser.html#sy...
There aren't any examples of using >>= previous to this question. Furthermore, the link to the Standard Prelude is not helpful because there aren't any examples of how to use >>=.
-- Met vriendelijke groet, Henk-Jan van Tuyl -- http://Van.Tuyl.eu/ -- Using Opera's revolutionary e-mail client: https://secure.bmtmicro.com/opera/buy-opera.html?AID=789433
participants (3)
-
Bryan O'Sullivan
-
Henk-Jan van Tuyl
-
Shannon -jj Behrens