W3C home > Mailing lists > Public > public-qt-comments@w3.org > April 2013

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

From: <bugzilla@jessica.w3.org>
Date: Tue, 30 Apr 2013 00:03:28 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-21797-523-85aICE6nhe@http.www.w3.org/Bugs/Public/>
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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:52 UTC