Archive for June 28th, 2006

Thermostat code release

I’ve released my simple fan control program described in this entry (see also part one).

THIS CODE MAY MELT YOUR CPU - download only if you plan to read it, test it, and/or hack on it. The license makes it clear that it comes with no warranty.

I’ve already received an interesting email from Mark M Hoffman in reply to my post to the mailing list announcing it, drawing my attention to PID control loops. Looks like it could be a worthy avenue of investigation. I’ve replied with a description of one issue I see with applying a PID controller in this domain.

2 comments June 28th, 2006 Paul Crowley

‘Code as Data’ != Closures

Today I googled for “code as data”. The first hit that came up was this, a tutorial on Groovy that cheerfully proclaims that what is meant by “code as data” is closures! No, no, NO!!!!

“Code as data”, aka “code is data” signifies the ability to manipulate code, i.e. to construct and take apart programs. At the most primitive level that can be accomplished by representing source code as strings, which is possible in most programming languages. Going beyond that, many programming languages define an AST data structure, with a parser and pretty printer, that allows manipulation of code in a more structured manner, enforcing most, if not all, syntactic constraints of the language.

However, neither of these approaches fully capture what is meant by “code is data” in the Lisp tradition. There code really is data. There is no special AST data type and associated parser and pretty printer. Instead all programs are represented in terms of the ordinary data types of the language, such as symbols and lists. The concrete syntax of programs is subsumed by the standard external representation of data.

None of this has anything to do with closures.

2 comments June 28th, 2006 matthias

Calendar

June 2006
M T W T F S S
« May   Jul »
 1234
567891011
12131415161718
19202122232425
2627282930  

Posts by Month

Posts by Category