18 June 2018
abs() function ins C/C++ is not defined for minimum negative int as the standard says:
The abs, labs, and llabs functions compute the absolute value of an integer j. If the result cannot be represented, the behavior is undefined.
gcc returns the same value in this case.
Heap’s data structure
Heap’s implementations do not have some useful functions like
remove_element in many languages. E.g. in C++ and Python.
Go’s implementaion actualy has both of the functions named as Fix() and Remove(): Package heap.
Combining hash values
XOR is not always the best choice to combine hash values. E.g. for a pair of int it will always returns 0 if values are the same.
Boost uses the following approach to avoid such collisions:
seed is a previous result of
hasher or this algorithm.
Some good advices are available in Writing a hash function in Java: a practical guide to implementing hashCode() (suitable not only for Java, of course).
This piece of code taken from the article: ReasonML - React as first intended.
There are quite a few languages in ML family: