How does currying work?

Understanding higher-order functions Haskell, as a functional language, supports higher-order functions (HOFs). In mathematics HOFs are called functionals, but you don’t need any mathematics to understand them. In usual imperative programming, like in Java, functions can accept values, like integers and strings, do something with them, and return back a value of some other type. … Read more

Does Haskell have return type overloading?

Well, one way to look at it is that Haskell translates the return type polymorphism that you’re thinking of into parametric polymorphism, using something called the dictionary-passing translation for type classes. (Though this is not the only way to implement type classes or reason about them; it’s just the most popular.) Basically, fromInteger has this … Read more

Extracting the exponent and mantissa of a Javascript Number

Using the new ArrayBuffer access arrays, it is actually possible to retrieve the exact mantissa and exponent, by extracting them from the Uint8Array. If you need more speed, consider reusing the Float64Array. function getNumberParts(x) { var float = new Float64Array(1), bytes = new Uint8Array(float.buffer); float[0] = x; var sign = bytes[7] >> 7, exponent = … Read more