I'VE GOT THE BYTE ON MY SIDE

57005 or alive

Null-checking considerations in F# - it's harder than you think

May 18, 2015 C# F# performance

The near-complete obviation of nulls is perhaps the most frequently- (and hilariously-) cited benefit of working in F#, as compared to C#. Nulls certainly still exist in F#, but as a practical matter it really is quite rare that they need to be considered explicitly within an all-F# codebase.

It turns out this cuts both ways. On those infrequent occasions where one does need to check for nulls, F# actually makes it surprisingly difficult to do so safely and efficiently.

In this post I’ve tried to aggregate some best practices and pitfalls, in the form of DOs and DON’Ts, for F# null-checking.

A handy Powershell filter for converting plain text to objects

May 15, 2015 powershell

Working on the command line with Powershell, much of the time I have the luxury of dealing directly with rich .NET objects.  If I need to sort, filter, or otherwise process cmdlet output, I have easy access to typed properties and methods right at the prompt.

Often, though, I’ll need to wrangle plain text, perhaps from a log file or the output of an executable.  In these cases an intermediate step is required in order to extract the typed information (timestamps, substrings, numerical fields, etc) from the plain strings.

This comes up often enough that I whipped up a handy Powershell filter, ‘ro’ (for ‘regex object’), to make it easy:

Bug with Powershell Get-Date

Apr 1, 2015 powershell bug

5 years ago today, I sent the following bug report to the Powershell team.

Non-transitive Grime Dice, via Mathematica

Jan 16, 2015 math Mathematica neat

For Christmas this year, I got myself a fun mathematical gift: a set of 10 non-transitive dice, namely Grime Dice! You can get your own set here. Behold their dicey splendor:

grime dice

These dice possess the fascinating property that their winning relationships (in the sense of “winning” = “rolls a higher number > 50% of the time”) are non-transitive. i.e. if die A wins against die B, and die B wins against die C, it actually does *not* hold, in general, that die A wins against die C.  In fact, die C might win against die A!

Today is Phi Day -- at least, it ought to be

Jan 6, 2015 math rant

By now, most everyone is aware of Pi Day, celebrating the famous mathematical constant \(\pi \approx 3.14159\) on 314. On this day each year, students and math enthusiasts eat pie and engage in light-hearted \(\pi\) -related activities. Then there is e Day, a day for commemorating the equally-important-if-somewhat-less-famous constant \(e \approx 2.71828\) on 27. The activities are similar, though it’s less clear-cut what food one should eat (a high school teacher of mine insisted that the proper e Day food is waffles, evocative of the Cartesian coordinate system).  Even events like Pi Approximation Day (227 in day/month format), and Mole Day (6:02 1023) have gained enough momentum to warrant dedicated results from both Google and Bing.

So when is Phi Day?