purescript-deprecated / purescript-math Goto Github PK
View Code? Open in Web Editor NEWMath functions
License: BSD 3-Clause "New" or "Revised" License
Math functions
License: BSD 3-Clause "New" or "Revised" License
Tau Day is coming up next week... https://tauday.com/
It would be nice to add Tau to PureScript. Python 3.6 did it https://docs.python.org/3/library/math.html !
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 ?
I would be good to nail down some questions regarding the scope of this library. Specifically:
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?
ceil, floor, round should be Number -> Int ?
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.
To be compatible with MDN docs' license.
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.
Seems it is still in RC status.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.