Re: Comments on the File Module

A back of the envelope rewriting of the getChars example in an XQuery style...

declare function local:get-two-chars() 
as action(xs:integer+)
{
  do
  {
    $c1 <- fn:get-char();
    $c2 <- fn:get-char();
    return value ($c1, $c2)
  }
};

declare function local:put-two-chars($c1, $c2) 
as action(empty-sequence())
{
  do
  {
    fn:put-char($c1);
    fn:put-char($c2);
    return value ()
  }
};

do
{
  $chars <- local:get-chars();
  local:put-chars($chars[1]);
  local:put-chars($chars[2]);
}

Cheers,
   Tim


On 9 Dec 2013, at 18:22, Christian Grün <christian.gruen@gmail.com> wrote:

>> http://research.microsoft.com/en-us/um/people/simonpj/papers/marktoberdorf/
> 
> ;-) I’d love to see a proposal for XQuery side effect handling based
> on monads. Any volunteers?

Received on Monday, 9 December 2013 21:12:48 UTC