Tag Archives: pretentious-wank

Drinking the kool aid

Ahh yes I have indeed been partaking of quite a large volume of functional kool-aid lately, its quite scary. This week I’ve mostly just been doing lisp, lisp, lisp, and more lisp. In fact I don’t think I’ve touched Perl this whole week long, which is weird.

Still its been a good time, I’ve grappled with CLOS (let me fetch my crack pipe) and won the functionality I wanted, I’ve started to do more experimentation with some of the finer points of the whole style of coding itself.

For example, let me for a moment take you on a waffly journey around my criteria system (EDIT: Its probably worth knowing that I’m writing software that searches a graph of nodes and looks for suitable paths between any two nodes), for judging if a path has the right metrics/length/whatever to be acceptable.

We start with (make-criteria-pointer), this takes the name of a function and the arguments to pass to it, and returns a pointer to a function that takes a single path and runs the original function/args against it, returning true or false.

While that sounds a bit confusing, let me break it down for you, I’ve got a function for juding if a list is too long, which looks like this:

(defun max-length-p (path n)
  "Accepts a list-of-nodes (path) and an length (n) and returns T(rue) if the list is shorter than the length"
  (if (<= (list-length path) n)
      T
      nil))

So if I run

(make-criteria-pointer 'max-length-p 5)

it returns a pointer to a new anonymous function that looks like this:

(lambda (x)
  (max-length-p x 5))

i.e. it always checks to see if x is longer than 5 items long.

Now this doesn’t seem to be too useful, however there are simple ways to build a list of these function pointers, so if I do the following:

;; Maximum path length is 5
(new-criteria (make-criteria-pointer 'max-length-p 5))

;; Path must include one of the nodes foo,bar or baz
(new-criteria (make-criteria-pointer 'path-must-include-p '(foo bar baz)))

;; The minimum level of trust between nodes is 10
(new-criteria (make-criteria-pointer 'metric-p '("trust" 10)))

Then new-criteria keeps adding these function pointers to a list (called *criteria*, although you can tell it to add them to another list), and now if you say:

(check-path-p path-to-check *criteria*)

It will go through the list stored in *criteria*, passing path-to-check to each one of these functions and if the list doesn’t pass muster then check-path-p just returns false.

metric-p is also a generic checker of numeric (or other) values on links in the path, and so you can make it do crazy shit like this:

(metric-p path-to-check 
          '("bananas" "plenty") 
          :test #'(lambda (x y) (check-number-of-bananas x y)))

And it’ll dig up the “bananas” value about each link in path-to-check and instead of just checking this value numerically it will pass x (the value from each link) and y (“plenty”) into the newly defined function (lambda is an anonymous function), which will call check-number-of-bananas on these two values to determine if the link has “plenty” of bananas.

Now I’m sure there are plenty of other ways of doing systems like this but frankly Lisp can be deeply satisfying to write this kind of thing in. Once I got the last bits of this system in place this evening I left work pondering ways to improve it for speed or functionality, and have a list of three/four more things it could do by the end of Monday to complete it.

Just so damn shiny!

Surreal comedy and the Culture

Well firstly I’d just like to link you to a surreal comedy show linking aerobics with learning English (specifically about what to say if you get mugged).

Now thats done I’d like to ramble a little about The Culture and Woolworths. Now theres a lovely bit in at least one of the Culture novels where Banks, via his characters, asserts that “Money implies poverty” or similar wordings and indeed I got that impression again yesterday.

Being in town and thirsty I proceed to stroll into Woolworths since I know they would sell me my beverage of choice, upon selecting a bottle of said drink I noticed that again they had a 2 for 1 sale on it, literally even though I wasn’t thirsty enough for two it made no economic sense for me to not take two. I may drink the other bottle today, maybe tomorrow, it’ll keep, but thats no the point, I didn’t need it then and really felt no need to deprive another of the available resource but since it cost me none of my shiny tokens I thought I may as well walk off with it (as it would cost me more later should I want it and not take straight away).

Without the driving motivation of shiny tokens I feel small wasteful situations like this could be avoided, although I’m going to be the first to admit that you can only ignore money when your culture is post scarcity I think, I’m not sure theres a better way of divvying up resources amongst the world then to make them trade tokens for what they want (including the hiring of other people for said tokens).

Still, in a few hundred or thousand years if we’re lucky our society (well, what started as our society and since grew in strange and unimaginable ways) will work out some crazy way of becoming closer to post-scarcity and we can hopefully start to throw off the shackles of money, I’ll never see it, and indeed I reckon my brain is too closely molded to the current model to get on with living in such a way, but I feel its worth pondering.

Waffle, MLP and stuff, from the Laugh-its-funny dept.

[[ WARNING: before you read this note I can’t seem to concentrate on typing for sleepiness tonight and some sentences of mine seem to lack words in the middle, be warned! ]]

(Before I begin roleplayers in the audience might well appreciate Freebase, which I dug up links to textual versions recently. Freebase@squid.org Freebase@saturos.net).

Anyway now thats over I thought I’d stick a little something up to keep you all updated on whats going down in groove town.

Well first up busyness. Yes I know, its shocking I agree, but sometimes you just have a series of really busy weeks back to back. Still at least this stuffs interesting, writing up introductory material for teaching the Masters stoodents about Unix (with emphasis on Linux).

Fine introductory technical links, read them its interesting

Tuesday, the official day of broken things

Which of course means its also (on good weeks at least) the official day of fixing things, which is always satisfying.

The short version is:

1) mail swerver which got stroppy about me removing the UUCP user, but not stroppy enough not to send any mails at all, just some of them… or something. Anyway this one was my fault I’ll admit to that.
Result: Fixed and confirmed.

2) network simulation software, now with Bonus! IPv6 add-on. The v6 simulation that was actually wanted (although no one told me this when I started to beat this thing with a stick something like two weeks ago) was written for an old version of the IPv6 stuff that wouldn’t compile against any versions of the simulation stuff (bonus points for hard coded paths including /home/<username>/ in the make-files) so that it turns out is well broken.
Result: Well current versions of the simulation software and IPv6 stuff is working, so the people in question can now poke someone else to write a new simulation.

3) MIME parsing Perl. Oh the pain. My eyeballs. Recusion and pointers ahoy!
Result: Broken badly with Perl doing impossible things, so a job for tomorrow morning, where I’m sure it’ll just start working fine to taunt me :)

4) Gomi & Lain. Finally got around to hauling the disks out of the carcass of my old web/mail/DNS server Gomi and putting them into Lain (my ex-box) to make it do the useful server thing.
Result: All data recovered, one disk free and soon to go to a good home where someone can play with it (its too small and has too much death potential for me to rely on it).

So, I’d make that three out of 4, not a bad score for the day.

Oooh! And I got to watch the first episode of the new GIT:SAC season, now with a bonus free 30% political scheming!

On a more philosophical note I also had an interesting conversation about the nature of utopian thinking (well thats the thread I’m choosing to pick out, the conversation rambled all over in an interesting manner, but this is the part that I’m taking and extrapolating as a means of discussing my own path) how the hopes of youth in a bright and wonderful future thanks to X (the youths fascination) change to acceptance of the real world and the life-long quest to understand the self and work with others.

My own dreams of a utopia of well oiled, standard-maintained communication via computers (yes I was young, no one was sticking to net.standards long before my birth :) ruined by the fact bandwagon jumpers who didn’t love the ideal behind that vision.

Of course back then I could hardly concieve that anyone could exist who loved tech and didn’t share the vision of private but beautiful (yes I hadn’t read the SMTP RFC, I thought it was neat back then and not a giant ugly bodge based on FTP) communication that could bring the world together through discussing things.

Needless to say I got better since, my first job followed by a degree (and watching the technical world slide further into a morass of law-suits and petty idiocy) I’ve come to be the cynic you all know and love :)

But sometimes I still feel starry eyed, as I watch the packets fly across the networks, remembering how it felt when all this was new to me and I wonder what I can do to help bring at least a part of that vision to the world (in this case I can do it by finishing my thesis and producing some code to add another level of mess to email :)

Dream on young ones, but always come down to the ground at least sometimes to try and understand yourself and help the world, man cannot live just by flying free of earth.