Re: """"strings""" in Turtle (was Re: Turtle note possibilities)

At 09:56 25/02/05 +0000, Dave Beckett wrote:
> > -- \c
> > charEsc         = choice (map parseEsc escMap)
> >                  where
> >                      parseEsc (c,code) = do { char c; return code }
> >                      escMap            = zip ("nrt\\\"\'") ("\n\r\t\\\"\'")
>
>...
>
>I can't decode what that means but is it allowing \n \r \r \\ \" and
>\' ?

Yes.

(I agree that's a bit obscure if you're not used to reading this kind of 
code.  'choice' is a higher order function that creates an 
alternative-parser from a list of parsers,  'parseEsc' creates a single 
parser from a pair (match-char,return-char), and 'zip' combines two lists 
into a list of pairs.)

As to whether this is the Right Thing, it's entirely possible that I took 
the specification from Python, but I couldn't swear to that.

#g


------------
Graham Klyne
For email:
http://www.ninebynine.org/#Contact

Received on Saturday, 26 February 2005 08:19:27 UTC