Bobbing for Kernels

See Bob. See Bob bob. Bob, Bob, bob!

Same Five Digits

Posted by kernelbob on March 20, 2011

Enigma is a weekly column in New Scientist.  Every week it has a new puzzle.  Some of the Enigma puzzles could be solved using a computer.

This week’s puzzle, Enigma number 1638, is in that category.  Here are the facts of the problem.

  • I am thinking of three numbers.
  • Each number is a perfect square.
  • Each number has five digits.
  • Five different digits occur in all three numbers.
  • Each of the five digits occurs a different number of times.
  • The five numbers of times is the same as the five digits.
  • No digit occurs its own number of times.  (E.g., 4 is not used 4 times.)
  • If you knew which digit occurs once, you could uniquely identify the numbers.

Your task is to write a program that finds and prints the three perfect squares I am thinking of.

Read the rest of this entry »

Posted in Uncategorized | Leave a Comment »

Reading List

Posted by kernelbob on January 24, 2011

I’ve been doing some reading this weekend.  This post records a little of what I’ve learned.

The focus has been Scheme macros and separate compilation.  I’m trying to understand how a production quality Scheme system “should” be organized.  “Should” is in scare quotes because every Scheme user has at least one opinion on the topic, and no two seem to agree.

So here are the papers I’ve looked at in the last few days.

Read the rest of this entry »

Posted in Scheme | Tagged: , , , , , | 1 Comment »

A Safer Scheme Interpreter, Part 3

Posted by kernelbob on January 4, 2011

In Part 1, I explained why my Scheme interpreter, Schetoo, has the ability to fail or restart any instruction.  In Part 2, I showed how it automatically checks that instructions do all necessary checks before they have any side effects.  Those two posts described raising exceptions with longjmp, but didn’t really explain how the interpreter catches exceptions.

Read the rest of this entry »

Posted in Scheme | Tagged: , , , , , , , | Leave a Comment »

A Safer Scheme Interpreter, Part 2

Posted by kernelbob on January 3, 2011

In my last post, I promised to explain how my Scheme interpreter, Schetoo, can automatically verify that its instructions are restartable.  But first, some background.

Read the rest of this entry »

Posted in Scheme | Tagged: , , , , , , , | 1 Comment »

A Safer Scheme Interpreter

Posted by kernelbob on January 2, 2011

In the first half of 2010, I wrote a Scheme interpreter which I called Schetoo. It is a sequel to an interpreter called kbscheme, which I worked on off-and-on in 2008 and 2009. Both are written in C.

You can see them both on github.

https://github.com/kbob/kbscheme
https://github.com/kbob/schetoo

I undertook these projects to learn more about Scheme, interpreters, and garbage collection. Along the way, I came up with an interesting technique to make interpreter implementation less error-prone. That’s what I want to write about today.

Read the rest of this entry »

Posted in Scheme | Tagged: , , , , , , , , | 3 Comments »

Variadic functions in C: a new idiom?

Posted by kernelbob on April 5, 2010

For a long time, C has let you write functions that take a variable number of arguments.  But C leaves it up to each variadic function to figure out how many arguments it’s been passed, and up to each caller to pass the right arguments.

Here’s a cute hack to make variadic functions easier to write and a little harder to call incorrectly.

Read the rest of this entry »

Posted in C | Tagged: , , , | 5 Comments »

Son of Scheme: Introducing Schetoo

Posted by kernelbob on February 13, 2010

I’ve started a new Scheme project. This one is called Schetoo. The name has connotations of “Scheme Two”, “me too”, and “Gentoo” (a hardcore Linux distribution and a breed of penguin).

A ‘blogger named Peter Michaux started a series in January called Scheme from Scratch. His goal was to write a very quick and dirty Scheme, just enough to bootstrap a Scheme compiler. I read his postings and decided to get started again.

Schetoo is similar in concept to my first Scheme, kbscheme. In fact, I reused a fair amount of code to get Schetoo up and running faster. But at the same time, I’m applying what I learned to try to get a better design.

I’ve published the code on GitHub.

http://github.com/kbob/schetoo

Read the rest of this entry »

Posted in Scheme | Tagged: , , , , | Leave a Comment »

Mac Mini Video Upgrade

Posted by kernelbob on January 12, 2010

I recently upgraded our Mac Mini media center with a new video decoder board. Surprisingly, it worked.

Read the rest of this entry »

Posted in computers | Tagged: , , | 5 Comments »

Scheme from Scratch

Posted by kernelbob on January 12, 2010

Peter Michaux has started a ‘blog series called Scheme from Scratch. He’s made ten posts so far. He’s developing a Scheme system incrementally, in tiny steps, so that it’s easy to read along and understand exactly what every bit of code does.

Recommended.

Posted in Scheme | Tagged: , | Leave a Comment »

Scheme: Retrospective

Posted by kernelbob on January 9, 2010

The Scheme interpreter project is “on hold”. Maybe it’s “finished”. It’s time to take stock, see what I learned, what I accomplished, and what I could have done better.

Read the rest of this entry »

Posted in Scheme | Tagged: , , , | 2 Comments »