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.


In reply to Re^4: Take the Arc Challenge by Joost
in thread Take the Arc Challenge by kyle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.