xsl-list
[Top] [All Lists]

RE: [xsl] Esoteric XSLT/FXSL question

2008-05-28 13:31:00

Now, the FP alphabet of functions includes as its signature 
functions, "map", "fold" (aka "reduce") and so on.

However "so on" rarely includes "foreach" as a signature 
function of the FP idiom.  Is this because "foreach" implies 
some kind of time ordered calculation, and therefore not optimizable?

xsl:for-each is essentially a map() or apply() function. More specifically

<xsl:for-each select="S">
  <instructions/>
</xsl:for-each>

is equivalent to the higher-order function call map(S, instructions) where
"instructions" is interpreted as a function applied to the context node.

The use of the English words "for each" is a mixed blessing. On the one
hand, it makes your typical user less uncomfortable than if it were named
xsl:map. On the other hand, it gives people the wrong impression that it is
procedural.

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>