Fuzzy Grouping

A former colleague got in touch recently with a question about how one might perform the following grouping operation… Given a set of medical terms that may include typos and variations (as is typically the case for real-world medical data) group “similar” items together in the …

Friends, Romans, Countrymen, lend me your debuggers

This was just going to be a short toot, but it keeps growing so I moved it over to here. I thought I was about to have the shortest “cheat” solution to an #Exercism problem - Roman Numerals - where we need to convert a number to roman. R already has as.roman() though it returns an object …

Filtering Vectors

I saw a YouTube short demonstrating how to use filter() in Python along the lines of nums=range(1,30) def is_prime(num): for x in range(2,num): if (num%x) == 0: return False return True primes=list(filter(is_prime, nums)) print(primes) # [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29] and as always, I like …

FizzBuzz without an if

Apparently using an if to solve FizzBuzz is a sign that you’re not a great programmer… Well, that’s how I would have done it :-( I wanted to see what the map alternative looked like, and I found this python example print(*map(lambda i: 'Fizz'*(not i%3)+'Buzz'*(not i%5) or i, …

Implicit or Explicit connection object?

I’m wrapping a (stateless, hit-every-time) REST API and my design was challenged with an alternative opinion - which is great! I get to have a more serious think about design and what might work best. I have an internal function which does the actual talking to the server, e.g. .get_from_API() …

R challenge - contour in a matrix

As part of what will hopefully become a larger post, I’m interested in finding an R way to achieve the following: given an n x n matrix of zeroes with a single non-zero element of some value v, fill the surrounding entries such that each other element is at most one less than those surrounding …

ByRow optimizations in Julia

I’m still fairly new to Julia, even though I’ve been trying to learn it for a few years. It’s extremely powerful (fast, expressive, … whatever metric you want to use) but with that comes some complexity. I saw this post in my feed and it seemed like a great bite-sized chunk …