[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XPath 2.0 - how much of XQuery should it include?


iterative expressions
Jeni,

Lisp provides loops and conditionals as expressions. They are incredibly
useful, since loops and conditionals can return values and be nested inside
other expressions.  All the C based languages (including Java) have
conditional expressions, written as (condition ? result-if-true :
result-if-false).  In Lisp, one can write things like:

(let ((x (loop for i from 1 to (length my-list) as item in my-list
            collect (+ i item))) ...)
which creates a new list made by adding the index of the item in the
original list to the item for each item and binds the local variable x to
the new list.
Conditionals can be written as (if condition result-if-true
result-if-false), and use it like this:
(some-function (if (> x 0) (f x) (g (- x)) ...)

Common Lisp may also be the origin of the names of the 'every' and 'some'
expressions in XPath 2.0.

Most Lisp programmers are unhappy to lose conditional and iterative
expressions when they switch to other languages.  In general, the statement
vs. expression distinction in languages is often more of a nuisance than a
help, particularly if you are trying to write a program to translate one
language into another.

Jeff


----- Original Message -----
From: "Jeni Tennison" <jeni@j...>
To: "Jonathan Robie" <jonathan.robie@d...>
Cc: <xml-dev@l...>
Sent: Thursday, May 09, 2002 4:44 PM
Subject: Re:  XPath 2.0 - how much of XQuery should it include?


> XPath 2.0 incorporates a number of *statements* that are already
> provided by XSLT 2.0. The for "expression" and the if "expression"
> would be classed as statements in any other language. XPath 2.0 also
> replicates other functionality that's already supported in XSLT:
> sorting, for example, and variable assignment (though obviously XPath
> 2.0 can only carry out variable assignment in limited contexts,
> something that in my opinion undermines the idea that for expressions
> can solve all the problems of sequence construction in XSLT 2.0).
> Obviously XQuery needs this -- it has to have statements because it
> isn't embedded in something that does -- but XPath 2.0 doesn't (or
> wouldn't if XSLT 2.0 was adjusted to enable it to create sequences of
> atomic values, something that I believe is entirely feasible).



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.