Anyway, in the intervening period I've taught myself - poorly - QWERTY touch typing. Go with the flow. I'm sure DVORAK is better, but for sure it's not so easy to have every keyboard in your life set up that way. We share computers at work.
Frink, sadly, is no longer part of my life. It's a great implementation of a language; everything you need to know on one page of extremely clearly written HTML; nothing too idiosyncratic in the syntax & a very clean implementation of classes. Someone should give Alan Eliasen (the author) a prize. But I found it was too difficult to publish Frink programs - people didn't feel comfortable, neither downloading it nor using it. So I switched to Javascript to build apps using PhoneGap / Cordova. This I succeeded in doing reasonably effectively. Yes, JS is a crappy kind of language, but I'm a crappy kind of programmer. Pragmatically, I can now develop for the internet & mobile platforms more or less easily. I can use Node for the desktop - although actually I've been using Python/Tkinter to build GUIs to support the JS application data. (That was really a terrible idea, but I stumbled across a couple of easy-to-understand websites on building GUI's in that framework, so it was easy. Now I've found 3 better GUI managers for Python than TK, but I can't be bothered. Admin GUIs are not a priority). Javascript has turned out to be precisely as productive a tool as I suspected.
Now, my life strategy is to avoid productivity by flitting from one thing to another. Right now I have a working Android app in alpha (with a long list of excellent enhancements); a working web app likewise; and a ton of (functional, useful) ideas that would leverage off the accumulated intellectual capital of those two projects.
So I've decided to teach myself J.
No-one in their right mind would do this - except that it may be unequaled as a way of wasting time. Here, then, are some of my rationalisations.
- It's a very interesting language, as in that mythical Chinese curse. And it surely is.
- It's a mathematician's language, and on the list of things I have to do is to improve my maths to a point where I can understand physics beyond baby talk. Well, of course, everyone should.
- It has a very dense vocabulary, and I have always hated verbose languages. Otherwise I'd have been a Java programmer 20 years ago. Density trumps accessibility; hence literature.
- It's a club! Who doesn't want to belong?
- It's a very different way of thinking about programming. Maybe that will improve my day-to-day programming, in the same way that, say, a 27 handicapper plays better golf using a centre-weighted, carbon-shafted one iron off the tee, instead of Big Bertha.
- It has an interesting history. Like LISP, Scheme and Prolog (every programming language), except more obscure.
- Sadly, I enjoy the masochism of teaching myself difficult things. The frustration, the self-hatred, the bad language, the tremendous sense of achievement when something actually works.
So here's how the first month has gone.
I decided to write a program to produce bridge hands according to specific criteria of strength and distribution. There's a couple of programs around that do this already, two that I know of in TCL and Python, but I thought it might be fun to play around with my own. (1)
There's quite a lot of documentation on J, but frankly, it's not very a ccessible. Someone says somewhere that you should read everything three times; once to get a general idea, once to understand specific things as they come needed, once to 'bring it all together'. That's sort of true - if for 3 you read '3* *: 3' (I think that's right, although 3^3 is more guessable). Everything seems to be documented, but finding it isn't easy and understanding it is harder. There are two main prose styles; comprehensible but not useful, and comprehensive but not useful. Save the 2nd category for the last 3 times of reading, when it may turn out to be a little harsh.
It is there though, so you can solve every problem you have if you bash your head against it hard enough and long enough. Plus, as an added bonus, you could easily be smarter than me.
If wasn't very hard to find a sample program for dealing hands. Alvord & Thomson's Easy-J gives you this:
13 ? 52
Brilliant, hey? Select 13 numbers between 0 and 51 without replacement. All done by the handy-dandy dyad ? . Bridge has 4 hands, not one, of course, but it didn't take long to work out that:
4 13 $ 52 ? 52
does the trick. 4 13$ produces 4 13-element lists, populated by the 52 random-without-replacement bit. OK, we have:18 48 20 45 15 3 35 32 0 7 13 22 31
16 5 28 19 8 43 27 41 17 14 40 38 44
21 4 50 29 51 10 47 24 34 6 26 30 37
39 42 1 23 2 11 49 12 25 46 36 33 9
This has taken about 30 minutes. I'm excited. J is awesome. I mean, it wouldn't take long to write the code to do that in any language, but it would certainly take up more space on the page. What next?
(1)And actually, thinking in J *has* given me an idea, which might be interesting, about handling distributions via the $ (shape) verb.
*Update - a bad idea.
No comments:
Post a Comment