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

what good does concise do if you have to learn a whole knew language to read it?
Are you suggesting that nothing is worth anything if you have to learn a whole new language? Or just brevity?

Arc is actually pretty easy to read if you know Lisp.

Replies are listed 'Best First'.
Re^3: Take the Arc Challenge
by eric256 (Parson) on Feb 05, 2008 at 16:03 UTC

    I don't think it is worth learning a whole new language just for brevity, I think in the end more time will be spent learning all those strange shortcuts than is saved by how short it is. I wonder if a regular Lisp program would be easier to read or if my confusion more centered around Lisp than Arc.

    If you consider that pretty easy to read then could you explain the example to me? Because I have no idea where its saving stuff in a sessions, where its generating HTML, whats responding to each HTML request, etc. I've never learned lisp and maybe thats the problem.


    ___________
    Eric Hodges
      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.