<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>29356</bug_id>
          
          <creation_ts>2016-01-03 21:30:29 +0000</creation_ts>
          <short_desc>Add fn:product</short_desc>
          <delta_ts>2016-01-03 23:35:46 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>Requirements for Future Versions</component>
          <version>Working drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Benito van der Zander">benito</reporter>
          <assigned_to name="Jim Melton">jim.melton</assigned_to>
          <cc>mike</cc>
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>124509</commentid>
    <comment_count>0</comment_count>
    <who name="Benito van der Zander">benito</who>
    <bug_when>2016-01-03 21:30:29 +0000</bug_when>
    <thetext>There is a fn:sum, but no fn:product

That does not seem intuitive. Both are the basic commutative arithmetic operations, there should either be both or neither.

It is also very useful to calculate the factorial: product(1 to $something)

From that you can define the binomial (which could also be useful in the math: module):

declare function binomial($n, $k) { product(($k + 1) to $n) div product(1 to (n - k)) } 

and work with combinatorics and stuff</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124511</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-01-03 23:24:59 +0000</bug_when>
    <thetext>It&apos;s very easy to define it yourself:

let $product := 
  fold-left(?, 1, function($x, $y){$x * $y})</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124512</commentid>
    <comment_count>2</comment_count>
    <who name="Benito van der Zander">benito</who>
    <bug_when>2016-01-03 23:35:46 +0000</bug_when>
    <thetext>But so is fn:sum and that is there

And utility functions seem to have become popular again, like fn:contains-token</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>