Arc, first impressions

I took a quick look at Arc. If nothing else, I want to see how it compares to Scheme. Here are a few remarks (in no particular order).

  • = is used for assignment rather than for equality testing. This may be confusing to people using other variants of Lisp. Possibly less so to users of languages that use the same operator. Still, inside parentheses it looks a bit odd: (= x 4)
  • Many abbrevations! Quite a few of them seem gratuitous; I'm used to def, but what about mac, rem, pr, prn, fn, o, and so on, some of which only shave off a character or two. It makes the resulting code a bit shorter, but whether it's clearer is a different issue.
  • The [ ... _ ... ] syntax seems useful. This is basically a shortcut for simple lambdas, e.g. [+ _ 1] is equivalent to (fn (x) (+ x 1)).
  • Odd assignment rules for lists and hash tables. E.g. if airports is a hash table, then (airports "Boston") looks up the key "Boston" in there. This also works in assignments: (= (airports "Orlando") 'mco). Lists work the same way, if I understand correctly. Personally, I think it's a bit confusing, and I'm not sure it's a good idea to overload this kind of syntax. (foo bar) can now mean: function application, hash table lookup, list lookup...
  • On the other hand, you get to do table lookups with map:
    (map airports '("San Francisco" "Orlando" "Paris"))
    => (sfo mco cdg)
  • On a side note, the use of hash tables for dictionaries, and the keys and vals functions to get keys and values, look suspiciously Pythonic. :-)
  • Compose functions with ":":
    odd:car is equivalent to (fn (x) (odd (car (x)))
  • "Negation" operator ~:
    ~odd? is equivalent to (fn (x) (not (odd? x)))
    N.B. It's not hard to do the same thing in Chicken... I already talked about defining custom literals in a separate post, and an implementation of ~ would use the same mechanism. More about this later.
  • if with more than 3 arguments is a nested if... e.g.
    (if a b c d e) => (if a b (if c d e))
  • Some forms were reinvented without parentheses, which is much clearer, IMHO. E.g.
    (let x 1 ...body...)
    (with (a 1 b 2) ...body...)
    Compare this to the parentheses-fest that is let in Scheme and Common Lisp. :-}

No "conclusion" at this point; I have only skimmed the tutorial and tinkered a bit with the REPL. Plus, it's likely to change anyway.

On forums, the biggest gripe people seem to have is the lack of Unicode support, and PG's apparent unwillingless to add it.

9 Comments »

  1. John Cowan said,

    January 31, 2008 @ 12:31 am

    Arc: not back to the future, but forward to the past. It basically takes all the hard-earned lessons of Scheme right up through R6RS and throws them in the trash.

  2. she said,

    January 31, 2008 @ 10:06 am

    The biggest problem is - someone that knows a lot of ruby or python, why would he ever go and try such a language?

  3. Hans Nowak said,

    January 31, 2008 @ 11:13 am

    @she: Well, it depends on your outlook. Assuming by "such a language" you meant "a Lisp variant", there are various reasons why people would be interesting in learning or trying it, even if they already know a dynamic language like Python or Ruby. Maybe they come from a mathematical background and find a Lisp more appealing than a language with more traditional syntax (although there are functional languages, like OCaml and Haskell, that fit the bill better). Or maybe they keep running into Python/Ruby's limitations and want more flexibility. E.g. in the Arc tutorial there are a few things that languages like Python just cannot do. (Although other Lisps can... this is why most Lispers seem decidedly underwhelmed.)

  4. Hans Nowak said,

    January 31, 2008 @ 11:14 am

    @John: I am not all that familiar with the history of Scheme (yet); can you give a few examples of things Arc is doing that are (in your opinion) wrong?

  5. Deinst said,

    January 31, 2008 @ 2:26 pm

    @Hans: The major feature that arc fails to take from modern scheme systems is a sane module system. I find this surprising, given that arc is built atop mzscheme which has a simple (from a user point of view), solid module system. I suspect that pg would argue that a module system would interfere with the hack and slash philosophy that arc is supposed to engender, but I would argue that any language with macros needs a module system that can give a macro writer the guarantees outlined inin http://citeseer.ist.psu.edu/cache/papers/cs/26833/http:zSzzSzwww.cs.utah.eduzSzpltzSzpublicationszSzmacromod.pdf/flatt02composable.pdf

    This is one of the reasons I use mzscheme instead of common lisp. I'd love a language that had a good module system, macros and access to system threads, and would willingly sacrifice continuations and hygenic macros.

  6. ndanger.organism :: blog :: Arc: the blogosphere rages said,

    February 1, 2008 @ 12:04 am

    [...] Arc, first impressions: Hans is fair and balanced [...]

  7. The Arc Debate | LispCast said,

    February 28, 2008 @ 2:12 pm

    [...] Arc’s Out Lisp at Light Speed: Arc Brevity Zach’s Journal - Like a Bi-Metallic Strip Drinkable Chicken ยป Arc, first impressions (cadr life): Lazy Lists in Arc smuglispweeny: Arc!Cells: It’s Alive!!! smuglispweeny: [...]

  8. John Cowan said,

    March 3, 2008 @ 9:41 am

    1. The overly short names. If PG wants APL (or J, K, etc.) he knows where to find them.

    2. The irrationality and randomness of the names Scheme fixed this in R2RS.

    3. The invincible ignorance about Unicode.

    4. The belief (also ignorant) that hygienic macros don't matter. (Hygiene is to macros as lexical binding is to functions -- I suppose we should be glad that Arc doesn't revert to dynamic binding.)

    There are probably more, but I stopped looking at this point.

  9. Tim Lovell-Smith said,

    May 29, 2008 @ 11:53 am

    Re: 'Odd assignment rules for lists and hash tables.'

    If you think about it, hash table lookup (foo bar) IS a function application, i.e. computation of a mapping f(x). It's just different from most other functions in its method of implementation/specification, with e.g. being able to use = to modify the mapping.

RSS feed for comments on this post · TrackBack URI

Leave a Comment