Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

Dispatch on all binary operations

$
0
0

Hi all, been using Julia for sometime now, first time I’m posting here.

Is it possible for me to dispatch over all binary operations which have specific type arguments?

I’m working on a Fuzzy Arithmetic package, where Fuzzy Numbers are effectively a nested array of intervals but you do some funky stuff to the membership function.

I’ve got a method function which takes two Fuzzy numbers and a binary operation and computes the resulting fuzzy number

minMaxConv(x :: FuzzyNumber, y :: FuzzyNumber; op = +)

op can be any operation defined for an interval from IntervalArithmetic.jl.

Is there anyway I can dispatch on all binary operations from defined for type Interval instead of having to do:

+( x :: FuzzyNumber, y :: FuzzyNumber)  = minMaxConv(x, y, op = +)

Cheers :slight_smile:

4 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 2795

Trending Articles