Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8186439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:11:54+00:00 2026-06-07T02:11:54+00:00

I am using Unquote and did not see any approximate comprison. So I decided

  • 0

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/ ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T02:11:57+00:00Added an answer on June 7, 2026 at 2:11 am

    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:

    type Approximate = Approximate with
        static member inline ($) (Approximate, x:^n       ) = fun (y:^n) -> float (abs (x-y)) <  1.E-10
        static member inline ($) (Approximate, x:list< ^n>) = 
            fun (y:list< ^n>) -> 
                x.Length = y.Length && (List.zip x y |> List.forall ( fun (a,b) -> (Approximate $ a) b))
    // More overloads
    let inline (=~=) x y = (Approximate $ x) y
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Microsoft SQL Server 2005, is there any way to see when a table
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
(This question is related - but not the same - to this one) This
Using jQuery, one can easily find out whether a particular element is visible using
Using mercurial, I've run into an odd problem where a line from one committer
I currently have a database call which works in one area, but not another.
I have to remake backquote (with unquote and unquote-splicing) without using the builtins reader
Using PyObjC , you can use Python to write Cocoa applications for OS X.
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using TortoiseSVN against VisualSVN I delete a source file that I should not have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.