Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Rename round operator #332

Open
kevmal opened this issue May 15, 2024 · 1 comment · May be fixed by #333
Open

[Feature Request] Rename round operator #332

kevmal opened this issue May 15, 2024 · 1 comment · May be fixed by #333

Comments

@kevmal
Copy link
Contributor

kevmal commented May 15, 2024

FSharp.Stats.Ops.round shadows the existing round operator upon opening FSharp.Stats. Causes issues particularly with FSI when FSharp.Stats is opened, reevaluated code that relied on the F# round op then fails.

I propose round gets renamed, perhaps to roundTo so:

open FSharp.Stats
let a = 5.321
round a // F# op -> 5.0
roundTo 1 a //F# stats op -> 5.3
@kevmal kevmal linked a pull request May 15, 2024 that will close this issue
2 tasks
@smoothdeveloper
Copy link
Contributor

smoothdeveloper commented May 15, 2024

As a workaround, open FSharp.Core before using round a seems to be ok.

I was thinking of open type, but it occurs that it will still call FSharp.Core round

type Rounder =
  static member round v = round v
  static member round(upTo: int, v) = round v

open type Rounder

round(1, 4.44)

error FS0001: Expecting a type supporting the operator 'Round' but given a tuple type

roundTo seems intuitive with the suggested parameter order, maybe we'd want to already come up with open type because there are many ways to round things (up, down, closest to mid point, maybe others).

Maybe interesting to get @pblasucci & @baronfel opinions in terms of API.

related: #333

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants