Sha256: 0c73425de33646480dfff783f7cd568170bab24c6940a78d805637c36ead24ef

Contents?: true

Size: 599 Bytes

Versions: 2

Compression:

Stored size: 599 Bytes

Contents

require 'symath/value'
require 'symath/definition/operator'

module SyMath
  class Definition::Flat < Definition::Operator
    def initialize()
      super(:flat)
    end

    def description()
      return 'flat(f) - musical lower/flat/b isomorphic operator'
    end

    def evaluate_call(c)
      # Must normalize input, operation depends on factorized vectors
      return c.args[0].evaluate.normalize.flat
    end

    def to_s(args = nil)
      if !args
        args = @args
      end

      return "b(#{args[0]})"
    end
    
    def latex_format()
      return '%s^\flat'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
symath-0.1.1 lib/symath/definition/flat.rb
symath-0.1.0 lib/symath/definition/flat.rb