W3C home > Mailing lists > Public > public-cwm-talk@w3.org > January to March 2005

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

From: Graham Klyne <GK-lists@ninebynine.org>
Date: Sat, 26 Feb 2005 08:11:33 +0000
Message-Id: <5.1.0.14.2.20050226080730.024cee80@127.0.0.1>
To: Dave Beckett <dave.beckett@bristol.ac.uk>
Cc: public-cwm-talk@w3.org

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:11:01 GMT