Rcjp’s Weblog

January 31, 2008

Playing with Arc

Filed under: lisp — rcjp @ 12:12 pm

Paul Graham has made available a tarball prerelease of his new arc language. I’m currently running Ubuntu gutsy on my laptop so it needs a quick patch

~/lisp> tar -xvf ~/tmp/arc0.tar 
~/lisp> cd arc0
~/lisp/arc0> wget http://blakeley.com/linux-date.patch
~/lisp/arc0> patch arc.arc linux-date.patch 
~/lisp/arc0> rlwrap -C arc mzscheme -m -f as.scm
Use (quit) to quit, (tl) to return here after an interrupt.
arc> 

then you can go through the tutorial, or play with the webserver, which we’ll start in a new thread

arc> (defop hello req (pr "hello world"))
#<procedure:gs1431>
arc> (= webtest (thread asv))
#<thread: asv>
arc> ready to serve port 8080

and then look at http://localhost:8080/hello

The prompt doesn’t quite come back correctly here, but you can carry on typing

(defop hello req (pr "hello world changed"))
#<procedure:gs1438>

and refresh the browser. Kill the thread and quit with

arc> (break-thread webtest) 
arc> (quit)

Though initially disappointed that there was no native compiler (written in arc of course!), I’ve warmed to the syntax – I didn’t find myself in a fighting the language, or frustrated that I had to reinvent stuff I didn’t want to e.g., here’s how to split up a string using spaces or commas

arc> (tokens "abc def,ghi" [in _ #\ #\,])
("abc" "def" "ghi")

There’s plenty to play with by reading through the source. So far, it feels fun.

No Comments Yet »

No comments yet.

RSS feed for comments on this post.

Leave a comment

Blog at WordPress.com.