Functional Data Structures in R is out

My new book, Functional Data Structures in R, was supposed to get out early next year, then it was moved to the end of December, but yesterday I saw that it was already available at Amazon and today I received my courtesy copies.

It is a lot thicker than the last three books, but do not let that fool you. It is a bit longer in word count, about 50% longer than the others, and it just looks larger because they have used a larger font. That is really for the better, though, ’cause the previous three were really printed with too small a font for my liking. I need to use my glasses to read them.

Of the five R books I’ve written so far, this was the most fun. Beginning Data Science covers pretty basic stuff I used when teaching a data science class. Functional Programming and Object-oriented Programming got into some more advanced topics, but nothing really exciting if you are already a serious R programmer. So I didn’t learn so much myself from writing them. With Meta-programming I had more fun with experimenting with different things, but it is still just putting down the groundworks before I can do write something more exciting.

With Functional Data Structures I had an excuse to experiment with different data structures, and algorithmic programming has always been a passion of mine, so that was wonderful. These days I’m actually spending all my time implementing various string algorithms for a new class that runs in the spring, so I have the same kind of feeling about that as I had about writing this book.

Because I’m busy with the string algorithms—and a chapter I’m contributing to a book—I am not writing much these days.  I have planned out half of my next book, though, which will be on domain-specific languages in R. That is not in any sense of the word algorithmic programming, but it does let me use some advanced features, and I am having fun with thinking up good examples for that book. I expect that I will get serious about writing it early in the new year when I have the string algorithm class planned in detail, but I am not entirely sure yet. I have two other classes I also need to plan and prepare material for, and there might be some writing there that could turn into books, and if so, they will have a higher priority since I have deadlines for classes but not for R books.

Anyway, I had a lot of fun writing Functional Data Structures in R, and I hope people will find it useful. If you read it and enjoy it, please leave a review on Amazon. It really helps me selling the books if there are positive reviews.

Thinking more about Domain Specific Languages in R

I got started on a new book, on domain-specific languages in R, a little while back and also got started on the first proper chapter. Then I had to leave it for a bit to work on another project, but while it’s been simmering I’ve started to have second thoughts about its structure.

What I had in mind when I started was another short book where I would explain a little bit of meta-programming and a little bit about operator overloading and show how you could combine this to write small embedded languages in R. However, I’m now halfway through the first chapter that was supposed to be about how to use classes and operator overloading to do a bit of this, and it turned out to be all about proper language parsing and syntax tree manipulation, so now I’m thinking that I might as well do a proper job of it.

I’m not entirely sure how to structure the book, now, but I think I want some of the easy stuff in there still. Maybe start out with a chapter that shows this. I have a small example where I use delayed evaluation and some rewriting to optimise matrix multiplication and I could use that as a motivating example. Then the next chapter could go into some theory about parsing and evaluating expressions such to motivate the rest of the book.

I had a mental distinction in mind where I would distinguish between standard evaluation and non-standard evaluation, but I’m not sure that is the right way to split the book now. Instead, if I am going to treat books properly, I will make the distinction between parsing an embedded language and evaluating it. The evaluation part can then have some (simpler) standard evaluation parts and some (perhaps harder) non-standard evaluation parts.

I’ll be sitting on a train for an hour and a half today, so I have time to think about that.