Archive for September, 2010

Unlambda Checker

Been looking at Unlambda. and it’s website offers a simple algorithm for determining whether or not a string is a valid Unlambda program

def unlambda_checker(input)
     counter = 0
     input.split(//).each { |x| x == '`' ? counter += 1 : counter -= 1 }
     counter == 0

This has undergone rudimentary testing

Why people separate parsing and evaluation

I forget if I have announced it here, but I’ve got a small, crappy language called Rorth, which you can find on my github site (link on my software page.) I say crappy because it can’t handle nested blocks. Thats right, you can write an if inside a while, or anything like that. So I’ve set off on a quest to rewrite the rorth parser from scratch. I’ve been playing around with the recursive decent parsers people have posted on the internet for use, and they work fairly well. However, I wanted to write my own, so I started. I’ve learned about solid state automaton since I wrote the first parser, so this one looks pretty different. I hadn’t wanted to write too much code, so I implemented parsing and evaluation in one step. This turns out to be just fine if you have an if statement, and possibly a function declaration though I haven’t gotten to that part yet, but for while, it breaks down. It has to do with storing the code in the while block for later use, and identifying when a while block ends. So, I’ve learned that one does not place parsing and evaluation in the same step. So, no new parser for Rorth yet.


In my quest to provide something everybody already has, I present to you List, a simple Linked List implementation in Ruby. You can get it here, if you really want to. This is my first experiment in test driven development, and it┬ádefinitely┬áproduced many more tests than any other code I’ve written. We’re talking 8 tests for 2 classes, some 13 or 14 tests. It worked pretty well, but I don’t know if I’ll do it again. Maybe I won’t need to.

This is Just to Say

I’m sorry I accidentaly your entire base
Forgive me
But I had a rocket launcher, and the world was destructable

How to write a Poem in 5 Steps

Step 1, start writing.
Step 2, get distracted.