Thursday, 15 November 2007

Looking up from Blub

Thanks to Randy I have had a good few days looking up from "Blub".

So, Randy posted a comment about the soloution in J for the bowling game. I read that article a while back also. Except I looked at the J code and went "what a load of crap". And who could blame me? The code looks like crap, from , heres the code :-

framex =: 10 {. 0 {~^:a:~ _1 _1 ,~ i.@# >:@:+ 10&~:
scoreifframe =: 3 +^:(9<])`+/@|.\ ,&0 gamescore =: [: +/ framex { scoreifframe why waste your time with anything that looks like that? Well, as it happens, I think its a case of being a Blub programmer and running into "The Blub Paradox" as coined by Paul Graham and written about here

Basically, when you see a language which is more powerful than the ones you know, you're not going to immediately recognise it.

Anyways, having got Randys comment on my blog I thought I should be a bit thorough and have a look at this J stuff. I winced at the cryptic nature of the code. But even if it was cryptic, the quicksort on wikipedia in J code did impress me as its a single line of code....

quicksort=: (($:@(<#[) , (=#[) , $:@(>#[)) ({~ ?@#)) ^: (1<#) Which is a great example of Tacit Programming ( )

and J is an example of Function Level Programming ( )

and J is also a a non-Von Neumann programming language ( )

So, anyways, I downloaded J and started to wade my way through a fantastic tutorial on J at

Surprisingly quickly the cryptic squiggles started to all make sense and the stuff on hooks and forks in was really quite cool.


All this stuff comes back to a guy called John Backus, which most anyone who's done computer science will know, is responsible for Fortran and BNF ( a notation to define context free grammars ). He wrote a very famous paper where he basically criticises languages and their designers and tells them they are intellectually crippling the world of programming. Pretty much anything in the C C++ Java C# strain of languages is crap. Or at least a crippled way of writing programs.

Anyways, the paper is and its from 1977. It is a very good read. Except! I have read this before, really early on in my education. I remember the idea of getting around the von-neumann bottle was pretty cool but I barely paid any attention to it because it meant very little to me. There were more practical things to be doing like trying to write C and hack VGA X mode code.

Having said all that, I'm not sure if J is really *hugely* more powerful than other programming ideas however it provides quite a unique way of thinking about programming. That in itself is very good.

1 comment:

Randy MacDonald said...

A nitpick:

there is an extra space after > in the definition of framex

> : should be >:

Ron may have erred as well, but I did not check that.