class RDF::N3::Algebra::Math::Product

The subject is a list of numbers. The object is calculated as the arithmentic product of those numbers.

@see www.w3.org/TR/xpath-functions/#func-numeric-multiply

Constants

NAME
URI

Public Instance Methods

resolve(list) click to toggle source

The math:product operator takes a list of strings or numbers and calculates their sum.

@param [RDF::N3::List] list @return [RDF::Term] @see RDF::N3::ListOperator#evaluate

# File lib/rdf/n3/algebra/math/product.rb, line 16
def resolve(list)
  list.to_a.map(&:as_number).reduce(&:*) || RDF::Literal(1)  # Empty list product is 1
end