small medium large xlarge

Travis-tiy-sq_pragsmall
31 Dec 2010, 03:52
Travis Swicegood (117 posts)

Howdy all;

Been longer than I intended between updates. Been busy at work, but I’ve managed to keep the writing streak up. Today was day 57 (i.e., ~57 hours of work). I’m amazed at what I’ve got done with so little time spent consciously working on it. Really amazing what can be accomplished when you’re focused. Now, if I could figure out how to write for 30 - 40 hours a week, I’d actually be able to turn out books pretty quickly. :-)

The last few days haven’t been writing explicitly, they’ve been coding. Kind of cool bit of code, so I thought I’d share.

There’s @code@ blocks in Prag’s PML that contain the code. Writing unit tests for straight code is simple enough, but I needed a way to test code that’s supposed to be run in the REPL. Since I’m working with Node and the 0.3.x branch, there’s no guarantees that what I write today will be exactly by the time we’re ready to go to print.

To fix that, I wrote a script that parses the blocks of code that are flagged as runnable in Node and figures out what code is supposed to be run and what is output. Once it has that, it fires up a new window in tmux running Node then executes all of the code. After it’s finished, it saves the window’s output and compares it to what’s in the book. There’s some extra niceties like fuzzy matching (for example, dates – I match that the output was the same length, but that’s it) and the ability to continue between examples.

No, it wasn’t written in Node. :-)

-T

Generic-user-small
31 Dec 2010, 03:54
Larry Jones (89 posts)

I’m impressed that you have time to code tools and write each day!

What’s the secret?

Travis-tiy-sq_pragsmall
31 Dec 2010, 03:55
Travis Swicegood (117 posts)

Oh - I should add that this is fully unit-tested too. :-)

Travis-tiy-sq_pragsmall
31 Dec 2010, 03:57
Travis Swicegood (117 posts)

Larry;

I’ve got to admit, I’m cheating a bit. I figure working on this tool is work on the book so that counts as my “writing” for the day. There’s a lot of back and forth within the book as I got this working though. At this point it’s about working on the book, not just writing new material.

-T

Generic-user-small
31 Dec 2010, 04:55
Larry Jones (89 posts)

Thanks, Travis.

Fully unit-tested, too?

I guess its time to give up ;)

Generic-user-small
31 Dec 2010, 05:01
Larry Jones (89 posts)

(In the voice of Ee-yore)

Well, I’ve written a word or two today. It’s not quite as good as Travis. I guess I’ll never catch up. I suppose next he’ll have a proposal already written and another 57 straight days of writing done. Back to my dark office and my old computer, my few words, and my couple of unit tests.

(Back to normal voice).

Two Pomodoro’s today.

Here’s the counts:

5673 29861 228916 total

30k by the New Year!

You must be logged in to comment