Re: Does Codd's view of a relational database differ from that ofDate&Darwin?[M.Gittens]

From: Jan Hidders <>
Date: Sat, 25 Jun 2005 12:29:59 GMT
Message-ID: <b7cve.129823$>

VC wrote:
> "Jan Hidders" <> wrote in message
> news:P3%ue.129170$

>>Well, to be precise, the for expression in XQuery is based on the monoid 
>>comprehension for lists, not the monadic comprehension for lists. But that 
>>is not what you meant.
>>Let's look at the following example:
>>for $x in (for $y in (1, 2, 3) return $y + $y) return $x * $x
>>Can you tell me what the side effect of the nested return is? As far as I 
>>can see it simply returns a value as is expected from the list 

> OK, simplifying the notation a bit in the same way as we did for Daplex,
> would you say that the following translation is correct ?
> for $x in ( for $y in (1,2,3) return $y+$y) return $x*$x => map(\x->x*x ,
> map(\x-> x+x, [1,2,3]))

Yes. In this case that is correct, but note that in general the translation is

   for $x in e1 return e2 => flatten(map(\x->e2, e2))

> If the answer is yes, then the 'return' is just a lambda expression, right
> ?


> If so, then I retract my previous statemnt that 'return' in XQuery is
> equivalent to 'print' in Daplex.


> Just out of sheer curiosity, why then use
> the word 'return at all ?

Dunno. It came from Quilt, one of the fore-runners of XQuery. I suppose they thought it made queries easier to read and gave them a bit more SQL'ish flavor by starting each clause with a keyword. Either that, or they really liked the idea of being able to tell the world that FLWR expression should be pronounced as "flower expressions". :-)

  • Jan Hidders
Received on Sat Jun 25 2005 - 14:29:59 CEST

Original text of this message