Wednesday, April 25, 2007

Simple programming lab

When it comes to leisure, I tend to get too many irons in the fire. (So much to learn, so little time.) I'm trying to devote more time to learning more web technologies and languages I'd like to know better (lately, JavaScript).

I'm also trying to come up with a decent means of introducing the kids to programming. Added to that, I'm still working on refreshing and improving my skills in linear algebra. (And there are other projects as well.)

Lacking the time to do it all, I try to come up with projects that fulfill multiple objectives simultaneously. I'll admit doing linear algebra in JavaScript is a little sadistic--but... whateveh... as long as it works.

When I was introduced to Lisp, one of the things that appealed to me was the ease with which one could go between data and code. It's a snap to write code that generates code, self-modifying code, code that converts input to code, etc. because code and data amount to the same thing.

Similar powers exist in JavaScript thanks to the eval( ) function, which lets you evaluate a string and execute it as code.

Along the lines of what I did with the Excanvas example, I've thrown together what I'm calling "a simple programming lab." The system includes an instance of a simple class for output:

out.clear( ) clears the contents of the output window.
out.write( ) writes data without an advancing to the next line.
out.writeln( ) writes data and throws in new line (like Pascal).

Very simple stuff, really. It's one of the simplest programming environments I can imagine.



Post a Comment

Subscribe to Post Comments [Atom]

<< Home