In the post “Evolution of the aliveness of cells in a cellular automaton” I promised that I’d post a paper about the automaton I used to generate the pictures and the subsequent video. So here it is. But be aware that this is my very first (semi) mathematical paper ever, so don’t be to harsh with critics
You may grab the PDF file here or read the iPaper below
Just a quick note that today I added one my most favored features of LISP to uLISP: the
1
recur
keyword. It allows you to call a the lambda you’re in at the point recur is written, thereby enabling the use of recursion without having to give the lambda a name.
I also implemented the
1
range
function which creates sequences of numbers and uploaded a rudimentary reference documentation.
As the rising amount of posts per unit of time shows: I got a loot of spare time to waste these days. This is mostly because we’re writting exams these days and constant learning simply doesn’t work out. So I had to get another project.
A short while ago I bought myself a TI92+ for the math exams. Just after it arrived and I had it connected to my computer I thought: “wouldn’t it be cool to have LISP on that thing”. So I started writing:
Roughly two days later there is the first kinda releasable version of this neat little interpreter. It’s pretty much complete when it comes to features, but there are still some more things to do:
So, in case you want to have a look at it: here you go … the code is published under the terms of LGPL, so feel free to do with it whatever you like. But if it becomes SkyNet don’t blame me
Mostly this is just a sum up off the stuff I’ve done lately when I was not learning for my exams or have been to the Speicher. This time it’s propably the most useless peace of software that has ever been written on this planet (but still fun though). It’s filesystem using FUSE which allows you to mount the 512 bytes (yes, that half a kilobyte) of the ATmega168 of an Arduino in read-only.
That said, enjoy the code … play arround with it, or just shake your head and close this tab
The other day I was giving a presentation at UnFUG (during the Pimp my x86_64 lighting talk session). What I presented was exclusively console based. And as a programmer I love things I can automate, like typing during a presentation. So I wrote a little Ruby script to do the job for me and bound it to some key-strokes using my window manager on the eeePC. That thing is even able to fake typos, and has some random timing to not let the typing become to regular and fluent. In order to run this script below you’ll need the xdotool.
During the preparation time for my exams I wanted to do something else than just learning. So I decided to give functional programming a try. The language of choice was Clojure. It’s a LISP written specifically for the JVM. This language got some pretty neat features (taken from wikipedia):
Dynamic development with a read-eval-print loop
Functions as first-class objects with an emphasis on recursion instead of side-effect-based looping
Provides a rich set of immutable, persistent data structures
Concurrent programming through software transactional memory, an agent system, and a dynamic var system
Compatibility with Java: Clojure can natively call methods and create objects from any Java library, and Java programs can call Clojure functions
Clojure is a compiled language producing JVM bytecode
To try this thing out I decided to implement the a2 automaton described a few posts before (those neat picture and the videos, etc.). So below is the code for the automaton. If you’re able to read/understand LISP this should be (hopefully) understandable . Especially the
moore-aliveness
function is really neat.
All in all it took me about 8 hours to write this code. Functional programming is a completely new world. Especially that we’re mostly working with immutable data here. That’s also the cause for this code being propably pretty slow. My use of recursion here is most likely not the way that is supposed to be done in Clojure. Anyway it was a fun experience and broadened my (programmers) horizon.
(defn moore-aliveness ([field x y] (let[n (vector [-1 -1][0 -1][1 -1] [-10][10] [-11][01][11])] ((fn [a i](do (let[rem(rest i)
cev (first i)
row (nth field (+ y (nth cev 0))[])
col (nth row (+ x (nth cev 1))0)
b (+ a col)] (if(nil? rem) b (recur b rem)))))0 n)) ))
(defn nextgen-for-row ([field row x y result] ;(println (str x "x" y ": " row)) (let[nx (inc x) rr (rest row) cr (first row)] ;(println (str "[" x " " y "] " cr)) (let[
nr (if(==(moore-aliveness field x y)2)10)
nresult (conj result nr)] (if(nil? rr) nresult (recur field rr nx y nresult)) ) ) ))
(defn nextgen ( [field]( (fn [f y r](let[ny (inc y) nf (rest f) cf (first f)] (let[nr (concat r (vector (nextgen-for-row field cf 0 y ())))] (if(nil? nf) nr (recur nf ny nr))) )) field 0() ) ))
After I’ve been to the 25C3 and listened to quite a lot of electronic music there, I wanted to do something with visualization again. And while looking for a cool 3D engine for C++ (like Irrlicht), I stumbled uppon fluxus. But Scheme is really not my programming language (at least not yet ), so I wrote something similiar in Java using JOGL and JRuby.
Tonight I got the first visualization running on live data being broadcasted by my iTunes using OSC. Some source code and more teasers will follow. Meanwhile, have a look at the screenshot:
Btw. just to have that meantioned here, JRuby is extremely fast (at least the way I’m using it). The guys who wrote that awesome library did a wonderfull job. The next steps will be most likely add some more features (e.g. make the OSC stuff easier) and start playing arround with the SuperColider.