Server outage
Sorry everybody.
My server went down today at about 11:00. It’s back up now, with no loss of data.
Thanks for you patience!
Eric
Popularity: 2% [?]
Filed under Uncategorized | Comment (0)LispCast Episode 3
Episode 3 is ready! If you want to see code being refactored, check out this episode.
In this episode, using the acceptance tests we developed last time, I refactor the code to make it easier to read, maintain, and modify.
Video and source code are available.
[Edit: a larger version of the video is available now]
Next episode: adding database persistence.
I’d love your comments!
software used in this episode
Related Posts
Popularity: 3% [?]
Filed under LispCast | Comments (14)Time window matcher
Well, I did it: I succumbed to the allure and challenge of someone who posted a Ruby quiz on Usenet:
this is ruby quiz 144, anybody feel like doing it in CL?
Time Window (#144)
by Brian Candler
Write a Ruby class which can tell you whether the current time (or any
given time) is within a particular “time window”. Time windows are
defined by strings in the following format:
ruby
# 0700-0900 # every day between these times
# Sat Sun # all day Sat and Sun, no other times
# Sat Sun 0700-0900 # 0700-0900 on Sat and Sun only
# Mon-Fri 0700-0900 # 0700-0900 on Monday to Friday only
# Mon-Fri 0700-0900; Sat Sun # ditto plus all day Sat and Sun
# Fri-Mon 0700-0900 # 0700-0900 on Fri Sat Sun Mon
# Sat 0700-0800; Sun 0800-0900 # 0700-0800 on Sat, plus 0800-0900 on Sun
I was intrigued. So I did it. It’s a bit messy, as these things usually go, but it passes all the unit tests. I did it first in a Lispy way, by making it sexpression instead of strings, then I tacked a string parser on top of it.
You can find the code here: Ruy Quiz #144 Solved in Common Lisp . It requires lisp-unit, cl-utilities, cl-ppcre, and s-utils.
[edit: a new version is available, which I describe a bit here]
Please feel free to comment. I’d love feedback.
One of the things I love about doing these things is that you get a nice set of new utility functions when I refactor them. Sometimes I feel like if it didn’t require so many lines of code, then there’s nothing I really gain from it, besides the main function I write.
Here are some of the utility goodies I made:
- scan-and-bind macro, which binds variables from a regex match
- make-time function, which has the parameters of encode-universal-time reversed with default values
- (so I can write (make-time 2007 10 24) instead of (encode-universal-time 0 0 0 24 10 2007))
- hour-of and minute-of which give the hour and minute, respectively, from a universal time
- other minor functions. Check out the source if you want to find out more
I like these kinds of challenges. They help me grow as a programmer. And I think that fun competition between languages is healthy for all languages involved. One of the reasons I decided to take the challenge is that I feel like Common Lisp is challenged a lot by people who don’t understand it. I don’t know if this is the case for this particular post, but usually what ends up happening is that the challenge is easily solved in CL, then a lengthy argument ensues about how it wasn’t done correctly or whether it can be done in fewer lines of code in another language.
This pains me, because there are a lot of claims that Lisp dialects have many advantages over other languages. And many popular languages claim to have been inspired by Lisp. The question I think that comes to mind is: “if Lisp is so great, why hasn’t it been proven after so many challenges?”
Well, I’m not sure about this (and I’d love your comments) but I think one reason is that the Common Lisp community doesn’t challenge other language communities. Common Lisp is good at a lot of things. If we find those things it’s best at, and showed those things to the world, I bet people will understand. For instance, I believe that while other languages create mini-languages in character strings, in Common Lisp, we do it in the language itself, which might be hard to understand if you haven’t done it before.
By taking a proactive position, we might show that we are up for the challenge
So, right now, I’m looking for a challenge to post to the comp.lang.ruby newsgroup. I want one that will rattle them to the bone about the inadequacy of their language. Nothing big, just a whopper to get them thinking. Do you have any ideas? Let’s give them something to talk about.
Related Posts
Popularity: 3% [?]
Filed under community | Comments (5)New theme
We have a new theme to go along with our new domain!
Let me know what you think.
Popularity: 2% [?]
Filed under Uncategorized | Comments (3)LispCast Episode 2
Have you written your acceptance tests?
I have! And you can watch me in Episode 2 of LispCast! I use Selenium to develop acceptance tests for the software I created in Episode 1.
Watch the video here. Here’s the modified source code, plus the acceptance tests.
Relevant pages:
Let me know what you think!
Related Posts
Popularity: 4% [?]
Filed under LispCast | Comments (3)LispCast: Writing a simple Reddit clone in Common Lisp
Hey everyone! This is the first episode of LispCast. I had already posted this to Google Video, but unfortunately with the compression it applies, the text was unreadable. But it’s better now! I’ve also added sound, so it should also be more understandable.
Watch Episode 1 here. Download source code.
This episode: I create the beginnings of a Reddit clone using Hunchentoot.
Next episode: I create Acceptance Tests of the code from Episode 1.
Here is the software I use in the video:
Inspired by Screencast by Sven Van Caekenberghe
Related Posts
Popularity: 7% [?]
Filed under LispCast | Comments (18)