in reply to Re^3: Take the Arc Challenge
in thread Take the Arc Challenge

A couple of things help:

1. Arc is based on lisp/scheme. Lisp function and macro calls are normally of the form (functionname arg1 arg2 ... argn).

2. the only syntactically new thing in this example (compared to standard lisp/scheme) is the [  _ ] construct.

[  ... _ ... ] creates a function (like an anonymous sub as in perl) that takes one argument "_". Everything between the brackets is the function body.

2. The w/link construct doesn't put data in the session, but a closure. In other words, it constructs a link, which when clicked will retrieve the provided function and execute it. This makes the code extremely brief. Look up continuation-based web programming.

3. I would assume defop registers a function with a URL, and that input and submit are functions that generate form fields. I haven't looked into the web-based stuff too deeply yet.

4. pr prints.

See also http://ycombinator.com/arc/tut.txt

Update: lisp and scheme are neither build with the focus on brevity (though scheme thends to have shorter names for built-in functions) but either will allow you to write code that is very compact, because you can build your own language constructs right on top of the base language.

Depending on your point of view, Arc is not a language, it's just a scheme library written in scheme (though a pretty drastic one).

Update 2: the perl/Continuity example is actually very close the the original Arc code.