Programming

Two big ideas of SQL: The What, not How, and querying with ease

published on
There are many factors that have contributed to the slow but steady rise of the popularity and ubiquity of SQL as a way to work with data. Among all these factors, the most significant one in my opinion is the concept of “what” rather than “how”. The second factor of greatness of SQL for me is the ability to quickly and easily answer questions about data. I choose to start out with these two big ideas that to me, is fundamental to the language. Read More...

Bar-sized factorial

published on
What’s the first five digits of 1,000,000! or 1 million factorial? Let’s ask Haskell: Prelude> take 5 $ show $ product [1..1000000] "82639" (1043.56 secs, 1,444,511,743,624 bytes) Neat! But you might ask, how many digits is this rather large number, of 1 bar factorial? Let’s ask again: Prelude> length $ show $ product [1..1000000] 5565709 (1103.04 secs, 1,444,845,773,000 bytes) Wow! 5.5 million digits! Way more than all the electrons in the universe. Read More...

Permutations and combinations, and ways to calculate the number of draws in a lottery

published on
With a recent, unusually high Power Ball jackpot of ZAR ~220 million, we could not help discussing one’s chances for actually hitting the jackpot as a bit of nice office banter. Despite your personal take on the Power Ball and Lotto,� we can turn it into a nice mathematical puzzle, and sanatise the gambling aspect away. Yeah, we can do that, because we are into maths, programming and data! For the uninitiated among us, the way it works is simple really. Read More...