Broken interface of Math.min

In an article about creating a column layout I found the following two lines of code: var min = Array.min(blocks); var index = $.inArray(min, blocks); This first finds the minimum value in blocks and then the index of that value. This combination of lines is very strange. Array.min already knows the index of the minimum element and throws it away. Then the programmer needs to find the index again with a linear search....

April 29, 2014

Stability in column layout

I was reading the notes on programming PDF and found a discussion about writing min and max functions for multiple arguments. I didn’t what to use this for. Also there was a discussion about stability. Stability is when you leave elements in the same position when they’re the same. This seems to be about sorting. At the same I was implementing a Pinterest like column layout. I already had a working version....

April 29, 2014

Generic Programming, STL and Stepanov

Here are two talks about Generic Programming, that I like very much. Generic Programming is about much more then just C++ templates. Alexander Stepanov: STL and its Design Principles In this first talk Stepanov talks about concepts and not much about STL. As he says (paraphrased): STL is maybe the biggest library of its kind, but it’s just a small step in Generic Programming. There is much that can be done with Generic Programming, STL is just the beginning....

August 17, 2010