Subject: Re: Re: Re: A question about the expressive power and limitations of XPath 2.0
From: David Carlisle <davidc@xxxxxxxxx>
Date: Sun, 13 Jan 2002 15:30:46 GMT
|
> A general statement about what "for" cannot do: Any problem of sequence processing,
> which requires that the result of processing an item be used as input for processing
> the next item(s).
>
> Is this true?
yes I think so (ie you can't implement fold given map, more or less:-)
Of course you can generate a sequence of running totals using something
like
for $i in 1 to count($x)
return
sum($x[position() <= $i])
but that's not really a "running total" as the first bits are repeatedly
re-avaluated, whereas what you'd like to do is pass a two argument
function over the list where at each stage the first argumant is the
previous result and teh second argument is the new item.
David
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|