So, I need a new interest. Something I can do wherever and whenever, and in small snatches of time. Something I know I enjoy. Something like learning a new programming language1.
I've enjoyed programming since before high school, I've worked as a programmer and my undergraduate subject was computer science. All you need is a computer. Most languages have lots of good documentation and tutorials online, and you can bring a book for when a laptop is too much. You can read and practice in short increments whenever you have a bit of time. And programming is just like doing puzzles or word games: you give your mind a challenge, occupy your thoughts for a while and emerge refreshed and happy.
Better to pick something that teaches fundamentals. One thing many, though not all, of the languages above have in common is that they are functional to some degree. Big, established languages like Python and Ruby also support functional programming. So lets go back to basics, I figure. Let's learn Scheme, and specifically Guile.
I know about functional programming of course. And I use functional constructs in Python and other languages from time to time. But I've never tried to really live a functional life as it were, and I don't have an intuitive sense of how to do it right. By learning and using Scheme I will hopefully not just gain a new language but also enrich my programming abilities in general.
Scheme is a LISP-like language, but very minimalist2. On one hand, it makes Scheme an easy language to implement, and it has made it a fairly popular scripting language. On the other hand, the base Scheme specification is so spartan it is very difficult to use. Fortunately, like LISP it has excellent support for extending the language with new syntax, so all implementations are fairly full-featured in practice. Small but extensible is the best of both worlds in a way, but as each implementation does things in different ways, Scheme programs aren't very portable between systems. Even seemingly basic things like looping are actually add-ons to the base language.
Guile is meant to be an embedded scripting language for Linux and other Unix-like systems. That is, it's made to be easily connected to low-level code written in C. You can write the main code in the low-lever language and use Guile as a simple scripting layer. Or you can make Guile the main part, and use C to extend Guile with fast application-specific functions. Or you can skip the low-level code altogether and just use Guile as a development language in its own right.
As it is easy to connect it to lower-level code there are pretty good bindings to many Linux system libraries; there's support for threading and parallelization; and like most Scheme variants it has a very good numeric stack with built in seamless support for exact values (using fractions rather than reals), very large values, complex numbers and more. It is a full-fledged development system, not a toy language.
Guile version 2.0 was released this year with performance improvements, support for compilation, new, better libraries and much more, but for now I will use version 1.8, as it is the current standard version in Ubuntu. The extra features of Guile 2 do not matter while I'm still trying to learn. I thought I'd post about my progress here from time to time.
#1 I know I just lost about 90% of you reading this. It's OK; we're all different and so are our interests. Just skip these Guile posts if you're not interested.
#2 Scheme people sometimes brag that the entire Scheme specification has fewer pages than the introduction to the Common LISP standard.