Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Usenet -> comp.databases.theory -> Re: Does Codd's view of a relational database differ from that ofDate&Darwin?[M.Gittens]

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

From: VC <>
Date: Fri, 24 Jun 2005 18:05:10 -0400
Message-ID: <>

"Jan Hidders" <> wrote in message news:P3%ue.129170$
> VC wrote:
>> Maybe. Now that we are done with Daplex, let's talk about XQuery ;)
> By all means. Before we start let me confess that part of my research
> actually involves XQuery, so this is going to be a bit of a home game for
> me.

That's cool. Always glad to learn something new.

>> I say 'return' works in a way similar to print, namely creating a side
>> effect, changing the 'world' as it were, thereby destroying XQuery
>> expression declarativity. What's your interpretation of return ? ( I
>> want to say right away, to save us some time, that I believe one
>> cannot interpret 'return' as the monadic return function.).
> 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]))

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 ?
Why not just 'for $x in (1,2,3) $x+$x since the lambda can be deduced/or understood as present anyway ?



>>>There are operations in XQuery that have side effects, but the return
>>>clause is not one of them. The strange thing about the side effects in
>>>XQuery, by the way, is that they actually don't seem to make the language
>>>much less declarative or less functional.
>> I do not know XQuery very well. What other [than return] side-effect
>> operations do you have in mind ?
> The node constructors. They extend the collection of XML fragments that an
> expression is evaluated against with a new fragment that may then be used
> by expressions that are evaluated after them.
> -- Jan Hidders
Received on Fri Jun 24 2005 - 17:05:10 CDT

Original text of this message