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.

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: