[FoRK] Arc's out, Nu vs. newLISP,
and a retort to Paul Graham's elitism
<jbone at place.org> on
Tue Jan 29 20:42:34 PST 2008
God help me, I've been dabbling with Lisp(s) again.
I'm sure you've heard by now, but Arc is finally out:
I haven't played with it yet, but I have been playing with a couple
of other Lisp variants; burned most of the weekend on a handful of
related Lispy projects.
One of the languages I've been messing around with is Nu:
...is an embedding of Objective-C / Cocoa in Lisp. I've written a
few things in it so far: a few shell tools, a FUSE filesystem, and a
little bookmark tool I'm calling Tagster that'll mostly replace
(that's the intent, isn't quite "done" enough yet to use) another
delicious bookmark tool I've been using, Pukka. Here's an example of
Nu code, a shell tool for getting tinyURLs:
-- snip http://pastebin.com/f7dd163c1 --
(function shrinkUrl (in)
(set escapedInput (in
(set url (NSURL URLWithString:
(+ @"http://tinyurl.com/api-create.php?url=" escapedInput)))
(set data (url resourceDataUsingCache: YES))
((NSString alloc) initWithData: data encoding:
(print (+ (shrinkUrl (((NuApplication sharedApplication) arguments)
-- snip --
For comparison, here are shell and Python implementations of
(essentially) the same thing:
I'm coming to the conclusion that I reallyDontLike: ObjCStyleCode:
dueToTheRidiculouslyLongSelectors. Really, I find it hard to read.
OTOH, here is (mostly) the same thing in newLISP (sans shebang script
scaffolding, urlencoding and arg processing...)
(define (shrink-url url)
(get-url (append "http://tinyurl.com/api-create.php?url=" url)))
newLISP is really a weird beast. It is defiantly NOT lexically
scoped, rather has a weird fluid or dynamic scoping mechanism built
on the idea of first-class environments called "contexts." Contexts
form the basis of a kind of pseudo-module system, pseudo-object
system, etc. But it's funky, feels sort of retro. OTOH, it's really
seriously batteries-included, though; has built-in remote execution,
a web server with RESTful app framework --- that's built into the
interpreter, command-line option, NOT a library. It's even got
funky stuff like bayesian classifier functions and finance functions
like npv all built in --- not broken out into libraries or a standard
lib or anything, just built-in functions. And from the docs it's not
clear that the author understands the difference between threads
(which it doesn't support) and processes (which it does via fork and
exec wrappers.) Nonetheless it's one of the most immediately-useful
out-of-the-box programming environment I've seen in a while for a
wide variety of programming tasks.
And it's got the Best. Logo. Ever.
One of these days, if folks don't get their language crap together,
I'm going to have to scratch that lifelong itch and roll my own.
Maybe arc will help me avoid that.
OTOH, I tend to agree STRONGLY with the following author's assessment
of Paul Graham's arc-justifying manifesto:
More information about the FoRK