First Thoughts on GNU Guile


Synopsis: Baby’s first Lisp

I had my first encounter with Lisp this week. In the third lecture of the COP4020 (Programming Languages) class  I’m taking, our professor ran through demonstrations of multiple languages and runtimes, including Perl 5, C++, D, and… GNU Guile, an implementation of Scheme. I had heard of it before, and actually already had installed it previously, but never bothered to learn it. Fast-forward to three days later, and I had digested the entire reference manual.

I have some demos here: https://github.com/thosakwe/scheme-stuff, but here’s a contrived example:

(define (type-of x)  (cond    ((string? x) "string")    ((number? x) "number")    ((list? x) "list")    (else "something else..."))); You can guess what these result in...(type-of "hey")(type-of 34.56)(type-of '(a b))

Guile’s standard library is pretty massive, with built-in support for pattern matching, macros, and even an HTTP server/client.

Coming from only ever having used C-like languages (with the exception of OCaml), I avoided Lisp for a long time, and feared that (((((((all)) the))) parentheses)) would prove unmanageable. I was pleasantly surprised to find myself simply having a lot of fun. For the past few months, all I’ve been able to think is applying for internships, doing coding challenges, studying data structures/algorithms, and spending hour after hour solving Leetcode problems. This, though, was really a breath of fresh air, and reminded me that I really do love computer science and programming, even though sometimes things can be hard.

I’ll certainly be using Guile for one-off scripts and tiny, GPL-licensed programs in the near future. But for now, it’s time to get back to the Twitter HackerRank…