Interop Adventure: From .NET to Matlab and Back

A lot of exciting things start with the word interop, at least the chances to make several surprising discoveries are pretty high. So, we decided to call some Matlab functions from .NET, what could possibly go wrong? This post as a short summary of our discoveries by trial and error method. Why would anyone need that? Easy - because something we needed was implemented in Matlab and that was something using a bunch of mathy packages, which we didn’t want to spend years rewriting.

Abs Puzzle

If someone asked you to implement abs function (say, for ints), how would you do that? A simple experiment shows that almost everyone comes up with something like that, whether it’s F#, C#, Scala or anything else: 1 let abs x = if x < 0 then -x else x The obvious question - do the answers match your expectations? That depends… It’s quite obvious when you think about the corner cases - here it’s the minimal integer value:

FsCheck and co: Testing Excel Financial Functions

Excel Financial Functions library is a .NET library written by Luca Bolognese that provides the full set of financial functions from Excel. It can be used from both F# and C# as well as from other .NET languages. The main goal for the library is compatibility with Excel, by providing the same functions, with the same behaviour. The library was recently moved to GitHub and its new home is here.

It looks almost like a property

Based on a true story. Only the names, places, and events have been changed. Many people today forget that the tools are just tools. Doesn’t matter if it’s OO or functional programming, take any language: there’re plenty of ways to write awesome and even more - to write terrifying code. lets . compose . these . functions . until . your . type-checker . explodes . btw . did . you .

Log(music) with Undertone

Whether you’re a physicist, biologist, economist, data scientist, whatever, the chances are you’ll meet the Markov chains sooner or later. And today we’ll try them on… music! If you’re not up to the math part, feel free to skip it. Math The system states changes are represented with a help of transition matrix, describing the probabilities of possible transitions. This matrix is a key to determine the state of the model after n steps.