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

Re: Is xsl:for-each "syntactic sugar"?

Subject: Re: Is xsl:for-each "syntactic sugar"?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 07 May 2010 10:00:07 +0100
Re:  Is xsl:for-each "syntactic sugar"?
On 07/05/2010 07:27, Markus Karg wrote:
1. Everything that can be done using xsl:for-each can be done using a
recursive function. (True or False)

This is not true since in reality

It's true enough for quarter to three in the morning while watching xsl-list with half an eye and the UK election results with the other half (and being asleep with the rest)



the stack size limiting the number of
recursions is much more limited than the width of your CPU limiting the
number of iterations.

How much stack size gets used up is in large part a function of the compiler, although chances are that in practice you are right and that the recursive form will use more.


> So you can do much more loops than iterations.
Also, xsl:for-each is much easier to understand than a potentially
complex recursive function (you SEE that it is a loop, while you have
NOTICE that it is recursive).
> Also, xsl:for-each can (in theory) be
implemented using parallel execution (multiple cores) while recursion
necessarily must be a single core as it is up to the coder where / when
in his particular algorithm the recursive call takes place.

the rest is more or less agreeing with the answer I gave to point 4, which you didn't quote, that despite any theoretical equivalence between the forms a real compiler is going to have an easier job with the specific construct rather than trying to spot efficient idioms using more general programming forms.



David


________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________


Current Thread

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
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.