[Bug 21797] Ordering of parameters in '16.2 Basic higher-order functions'

https://www.w3.org/Bugs/Public/show_bug.cgi?id=21797

Liam R E Quin <liam@w3.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |liam@w3.org

--- Comment #4 from Liam R E Quin <liam@w3.org> ---
I'm mising why the second approach is more readable than the first in comment
3, although I agree the indenting and layout in the second example is better.
But, the following seems equally clear:

declare function
eg:index-of-node($seq as node()*, $search as node())
  as xs:integer* 
{
  fn:for-each-pair(
    function($node, $index) {
      if($node is $search) then $index else () 
    },
    $seq,
    1 to fn:count($seq)
  )
}

It depends on whether you need to know the operation or the operand or both in
order to understand - in most cases it's probably both. The function first
might feel closer to JavaScript and e.g. jQuery for what it's worth, and apply
and map in LISP derivatives feel more natural with the function first.

Overall I'm not so convinced about this change.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Tuesday, 30 April 2013 00:03:29 UTC