Re: New Functions

Hi,
> In the 20 years since XSLT 1.0, a large part of the user community has 
> become familiar with functional programming paradigms as applied to 
> languages such as Javascript, Python, and indeed Java, and 1.0 for 
> these users seems more and more dysfunctional (pun intended). I don't 
> think your view is typical.

Being able to do functional programming without hof was the best part of 
XPath 2.

Like in x[y]/z you get a filter for y and a map to z, but there are no 
functions involved

It was much better than doing the equivalent tasks with hof in other 
languages like x.filter(function(){return y}).map(function(){return z})



For any new hof with single arity parameter, one could invent an 
equivalent syntax without hof.

For example, index-where(A, function(){B})  could be written as A@[B]

 >The expression |fn:index-where((0, 4, 9), fn:boolean#1)| returns |(2, 3)|.

Would become |(0, 4, 9)@[fn:boolean(.)]|

 >The expression |fn:index-where(1 to 10, .{. mod 2 = 0}))| returns |(2, 
4, 6, 8, 10)|.

Would become (1 to 10)@[. mod 2 = 0]

>
> This is some of the thinking behind allowing abbreviated inline 
> functions such as
>
> group-by(//employees, ->{@location})


Well, that is better than function(...

Best,
Benito

Received on Monday, 30 November 2020 22:32:20 UTC