Giter VIP home page Giter VIP logo

purescript-math's People

Contributors

brainrake avatar franklinchen avatar garyb avatar hdgarrood avatar jordanmartinez avatar kl0tl avatar liamgoodacre avatar matthewleon avatar paf31 avatar rgrempel avatar thomashoneyman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

purescript-math's Issues

Generalize max, min

Because those functions have the signature Number -> Number -> Number and I worked with Int, I found myself reimplementing this function for Int.

Maybe I missed an obvious trick, but should it be possible to implement those functions for types which implements Ord typeclass ?

Library scope

I would be good to nail down some questions regarding the scope of this library. Specifically:

  1. Should it support functions added to the JS Math object in ES6?
  2. Should it support other useful math functions and constants?

The function Math.random() is not supported and I think that leaving it out is uncontroversial.

On 1, the library currently supports the ES6 functions imul and trunc with polyfills but no others. So we have some options:
1a. Strictly no ES6. Remove imul and trunc
1b. No changes. Leave imul and trunc but add no others
1c. All ES6. Add all missing functions (except random). This would fix issue #25.

There are currently two open PRs (#19 and #21) that contribute some ES6 functions. They have been open for some time. I'm not sure why they haven't been accepted but the polyfills have some overflow issues. I recently released purescript-math-es6 which contains all ES6 functions with robust polyfills. The project purescript-math-es6-quality lets you see how well the polyfills match native values in Node.js and the browser. purescript-math-es6 could be merged into this library if full ES6 support is required.

My vote is 1c achieved by merging purescript-math-es6. But I am biased.

On 2, the library currently supports the function remainder/% and the value tau which are not properties or methods of the Math object. PR #29 would add the golden ratio as another constant. Similar to 1 we have three options:
2a. Strictly Math properties and methods. Remove remainder and tau. Removing remainder would be a significant breaking change
2b. No changes. Leave remainder and tau but reject the golden ratio and make it clear in the README that other math functions and constants will also be rejected
2c. Accept the golden ratio and update the README asking for additional math functionality

My vote here is 2b. I think the library should just reflect the JS Math object but the changes from adopting 2a would be too painful. Perhaps we could move remainder to Data.Number and add depreciation warnings to remainder and tau so we can eventually remove them.

Thoughts?

Rename "log" function to "ln"?

While working on purescript-batteries, I ran into a collision between Math.log and Control.Monad.Eff.Console.log. I think people are more likely to mean Console.log than Math.log when they just say log. And since Math.log is the natural logarithm, it can unambiguously be called ln, avoiding the collision.

Obviously this isn't a problem with this package per se. I could (and may) address this in purescript-batteries. But I wanted to open an issue here for discussion.

Deprecate this repo

CC @thomashoneyman

This repo's contents were ported to purescript-numbers and purescript-integers. All core, contrib, web, and node libraries imports and dependencies have been updated to remove this package. Moreover, the upcoming 0.15.0 package set builds without this package. purescript/package-sets#1075

We can now deprecate this repo.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.