## New book: The Beginner’s Guide to GitHub

I finished some lecture notes on how to use git and GitHub yesterday, and since I had them all written up in Markdown I could translate them into a booklet at the click of a button—which I did—and then put the booklet on Amazon.

I had planned to put it up as a free book, but apparently I am not allowed to do that. They have a minimum price of $0.99 for all books, and books that are larger than 10Mb have a minimum price of$2.99. Since my booklet is full of screenshots it makes it just above 10Mb—so no option of giving the book away. At least, not unless I make it available somewhere else, but I don’t really have the infrastructure for that, and Leanpub would cost me \$124 if I wanted to give it away there.

I could, however, enrol it in Amazon’s Kindle Select. It gives Amazon exclusive rights to the book but also enables some promotion options—including making the book free for a limited time. I have chosen that, and from tomorrow and five days on you can get The Beginner’s Guide to GitHub for free. I will re-enrol it in the free promotion again afterward, but I don’t know if there is a grace period between promotions. If there is, you just have to be patient. It will be free again later. But why wait, you might as well get it tomorrow. After all, if it is free, you can just delete it if you don’t like it.

This is my first experience with Kindle Select. My other books have been available on Leanpub and iBooks as well as Amazon from day one. I’m curious how this system works. I might try it with future books as well—for now I just need it to make this booklet free.

## Dictating instead of writing today

I have done something to my back that makes it very painful to sit at the computer today. It’s probably because I’ve been sitting too long at the computer the last couple of days. I have had this problem before, but usually only if I’ve been using the mouse too much. That hasn’t been a problem lately, but I do spend a lot of hours at the computer these days compared to some weeks ago. Anyway, I have some lecture notes that I would like to finish this week, so I can’t really give it a complete rest. So this gives me an excuse to try dictating text instead of writing.

I am dictating this blog post on my phone. I am dictating in the Ulysses editor. That is the editor I use for blogging. For some reason, I cannot dictate in Ulysses on my iPad. On the iPad I can dictate to iA Writer, but not Ulysses. On the phone I can dictate in both.

I’m surprised at how well dictation is working. When I tried it some years ago it really didn’t understand my thick Danish accent. Now it seems to understand most of the words I’m saying; I do have to change a few of them after I’ve dictated, but mostly to get stuff right. I still prefer using the keyboard over the microphone, but dictation is a working solution while my back is painful.

## This is moving in the wrong direction

It looks like my books are getting shorter and shorter…

Functional Programming in R was about 31,000 words.

Object-oriented Programming in R about 24,000 words.

Right now, it looks like Meta-programming in R will end up around 20,000 words.

I should probably think up a chapter or two more for Meta-programming in R so it doesn’t end up being too short. 25,000-30,000 words is okay for these books; they are supposed to be short, but they weren’t supposed to get shorter and shorter for each new book…

## Automatic differentiation in R

I’ve been working on a small R package that does automatic differentiation. It takes a function that computes an arithmetic expression as input and outputs a function that computes the derivative of the expression. You can check it out on GitHub.

I got inspired to write it a few weeks ago when one of our PhD students gave a talk on automatic differentiation. I didn’t attend the talk, but remembered playing around with it as a meta-program in C++ templates ages ago. Now that I am writing a book on meta-programming in R, I thought it would be a cool example to include there—and I have included it in the chapter I just finished. I gave it to a student as a project, but I am not patient enough to let someone else program it, so I have also done it myself.

It is actually a nice exercise to do. Differentiation is pretty simple to program. You just follow the rules you learned in calculus for the arithmetic operations and apply the chain rule for function calls. Nothing complicated there. To make it a meta-program in R, though, you need to know how to work with expressions and how to inspect functions to correctly apply the chain rule. While this is not particularly hard, this example is great at getting around the various corners of working with expressions.

Unless I think up something else to add, I think the meta-programming book will be done after one more chapter. After that, I will take a short break from the R books. I will get back to them in a few weeks, I imagine, but I have a few other projects to focus on before then. Including proof-reading my data science book—that should arrive next week and then I have to get through it in a week before it goes to the printer.

I haven’t decided yet what the next R book should be. I’m thinking either functional data structures and algorithms or embedded domain-specific languages. Let me know what you think.

## FP in R and Leanpub royalties

Now that I am selling Functional Programming in R I will no longer get royalties on Leanpub, of course. Those royalties are what I’m using to pay for the fee for new books there, and while I do have the money on Paypal from there to pay for one more, it doesn’t look like I will be able to keep up with earning enough between books to pay for the next.

Help me at least reach the break-even point with Functional Programming before I have to pull it down! If you haven’t gotten it already, go to Leanpub. It will only get more expensive once Apress owns it.