The Working R Programmer

Tips and tricks for serious software development in R

  • New Package Releases: foolbox and tailr

    I have just released version 0.1.0 of foolbox and version 0.1.2 of tailr. I haven’t actually done much on the packages the last three weeks, and they have been very close to these releases for a while, but now I had the spare time and energy to actually send them off.

    Read more…
  • “Optional” types using pmatch

    Some programming languages, e.g. Swift, have special “optional” types. These are types the represent elements that either contain a value of some other type or contain nothing at all. It is a way of computing with the possibility that some operations cannot be done and then propagating that along in the computations.

    Read more…
  • Lots of Function Transformations

    The last couple of days I’ve been doing a lot of experimenting with a package for function rewriting: foolbox. I am doing some function transformations in both pmatch and tailr and they look very much alike, so I figured I should collect the shared functionality in a separate package.

    Read more…
  • pmatch 0.1.3

    I have just released version 0.1.3 of pmatch to CRAN. There are not a lot of changes to this version compared to 0.1.2, but enough that I felt it would be good to get a version out before I pull the entire package apart to make it dependent on toolbox for its transformation function.

    Read more…
  • Transforming functions with cases calls

    The issue with byte-compilation I wrote about yesterday can indeed be fixed by transforming functions that call cases. And that was very easy to implement since I already had all the bits and pieces I needed for it from the tailr transformations.

    Read more…
  • Building a package that uses pattern matching

    After a week spend programming string algorithms in C—for teaching purposes, I am not working on a new read-mapper—it is nice to get back to programming in R. I made a new release of tailr today, so that is good, but what I really wanted to work on was matchbox.

    Read more…
  • tailr v0.1.1

    As I wrote about here and here, I had a problem in tailr with higher-order functions. In the transformation for tail-recursion optimisation, I need to know which actual functions each name refer to, in order to apply user-defined transformations, but with higher-order functions, those are not known until runtime.

    Read more…
  • Red-black trees in matchbox

    I’m working on implementing red-black search trees in matchbox and have managed most of it by now. I still need to implement deletion and the re-balancing code for handling those, but I have insertion up and running.

    Read more…
  • Linked lists in matchbox

    I have started playing with data structures in matchbox and the first structure I implement had to be linked lists. That is the most versatile data structure I use and it is missing from R.

    Read more…
  • Problems With Higher Order Functions in tailr

    Ok, there is a problem with higher-order functions in my tailr package that I ran into while writing linked list functions for my matchbox package.1 If you write a tail-recursive function that uses a parameter-function, the tailr package will complain that it doesn’t see that function in scope.

    Read more…