I am using Unquote and did not see any approximate comprison.
So I decided to write one.
let inline (=~=) x y = abs x-y < 1.E-10
However the operator is not mapped onto, say Lists
let test = [1;2] =~= [1;2] //---> error
Is it possible to declare this operator to flow like (=) ?
Or would it require to define a new traits like ‘StructuralEquality-ishness”?
Is it better to define a new operator with, say, http://code.google.com/p/fsharp-typeclasses/ ?
I don’t know Unquote, but regarding the approximate function/operator I’m not sure if there is a way to implement it with structural comparison.
If you want to do it “by hand”, using a technique (or trick) similar to the one used for the F# Typeclasses Project, here is an example: