Sha256: 055dba20b2dfc56a85951d7997721ff1dd43ee3e7dffed6f7f2607900c6f1059

Contents?: true

Size: 364 Bytes

Versions: 14

Compression:

Stored size: 364 Bytes

Contents

require_relative '../function'

Dentaku::AST::Function.register(:mul, :numeric, ->(*args) {
  if args.empty?
    raise Dentaku::ArgumentError.for(
        :too_few_arguments,
        function_name: 'MUL()', at_least: 1, given: 0
    ), 'MUL() requires at least one argument'
  end

  args.flatten.map { |arg| Dentaku::AST::Function.numeric(arg) }.reduce(1, :*)
})

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
dentaku-3.5.4 lib/dentaku/ast/functions/mul.rb
dentaku-3.5.3 lib/dentaku/ast/functions/mul.rb
dentaku-3.5.2 lib/dentaku/ast/functions/mul.rb
dentaku_zevo-3.5.2 lib/dentaku/ast/functions/mul.rb
dentaku-3.5.1 lib/dentaku/ast/functions/mul.rb
dentaku-3.5.0 lib/dentaku/ast/functions/mul.rb
dentaku-3.4.2 lib/dentaku/ast/functions/mul.rb
dentaku-3.3.4 lib/dentaku/ast/functions/mul.rb
dentaku-3.3.3 lib/dentaku/ast/functions/mul.rb
dentaku-3.3.2 lib/dentaku/ast/functions/mul.rb
dentaku-3.3.1 lib/dentaku/ast/functions/mul.rb
dentaku-3.3.0 lib/dentaku/ast/functions/mul.rb
dentaku-3.2.1 lib/dentaku/ast/functions/mul.rb
dentaku-3.2.0 lib/dentaku/ast/functions/mul.rb