[info] [FoRK] Arc's out, Nu vs. newLISP, and a retort to Paul Graham's elitism

Eugen Leitl <eugen at leitl.org> on Wed Jan 30 07:45:25 UTC 2008

----- Forwarded message from Jeff Bone <jbone at place.org> -----

From: Jeff Bone <jbone at place.org>
Date: Tue, 29 Jan 2008 22:42:34 -0600
To: Friends of Rohit Khare <fork at xent.com>
Subject: [FoRK] Arc's out, Nu vs. newLISP,
	and a retort to Paul Graham's elitism
X-Mailer: Apple Mail (2.752.2)
Reply-To: Friends of Rohit Khare <fork at xent.com>


God help me, I've been dabbling with Lisp(s) again.

I'm sure you've heard by now, but Arc is finally out:

  http://paulgraham.com/arc0.html

and

  http://arclanguage.org/

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:

  http://programming.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 --

#!/usr/local/bin/nush

(function shrinkUrl (in)
   (set escapedInput (in
     stringByAddingPercentEscapesUsingEncoding: NSASCIIStringEncoding))
   (set url (NSURL URLWithString:
     (+ @"http://tinyurl.com/api-create.php?url=" escapedInput)))
   (set data (url resourceDataUsingCache: YES))
   (set result
     ((NSString alloc) initWithData: data encoding:
NSASCIIStringEncoding))
   (result))

(print (+ (shrinkUrl (((NuApplication sharedApplication) arguments)
0)) "\n"))

-- snip -- 

For comparison, here are shell and Python implementations of  
(essentially) the same thing:

   Python:		http://pastebin.com/f16d6e317
   bash:			http://pastebin.com/f55e4477

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:

  http://lkesteloot.blogspot.com/2005/03/helping-average- 
programmer.html

Random musing...


$0.02,

jb







_______________________________________________
FoRK mailing list
http://xent.com/mailman/listinfo/fork

----- End forwarded message -----
-- 
Eugen* Leitl <a href="http://leitl.org">leitl</a> http://leitl.org
______________________________________________________________
ICBM: 48.07100, 11.36820 http://www.ativel.com http://postbiota.org
8B29F6BE: 099D 78BA 2FD3 B014 B08A  7779 75B0 2443 8B29 F6BE

More information about the info mailing list