Re: Does Codd's view of a relational database differ from that ofDate&Darwin?[M.Gittens]
Date: Sat, 25 Jun 2005 12:29:59 GMT
> "Jan Hidders" <jan.hidders_at_REMOVETHIS.pandora.be> wrote in message
>> >>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 >>comprehension.
> 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 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