Arc Forumnew | comments | leaders | submitlogin
Cool things about Clojure which haven't gotten much play (i.e. it looks like arc) (sjbach.com)
10 points by bOR_ 5921 days ago | 7 comments


5 points by cchooper 5921 days ago | link

It's good to see Arc stands up pretty well here. The destucturing syntax looks cleaner in Arc, and Anarki allows you to have multiple unnamed arguments too. Clojure's implicit gensyms are nice, but w/uniq isn't too bad.

Unfortunately, it has all the downsides too, and no SLIME integration (and I still can't get Arc mode running in Emacs) :(

-----

2 points by bOR_ 5921 days ago | link

Heh. trying to get arc running inside some environment as well. We'll figure it out :).

-----

1 point by projectileboy 5920 days ago | link

I second the implicit gensyms; I thought the syntax forit was decent.

-----

3 points by bOR_ 5921 days ago | link

This link came from reddit, and the blog mentions some fun but underlighted things in clojure. It is sort of funny that the second 'cool' thing the blog post mentions, it also mentions 'just like in arc'.

I quoted the relevant section of the blog here. 2. Unnamed arguments for short lambdas Pretty straightforward:

  (map #(+ % 4) '(1 2 3)) 
   -> (5 6 7)
   ;; Multiple arguments.
  (map #(* %1 %2) '(1 2 3) '(4 5 6))
  -> (4 10 18)

  This is roughly equivalent to Arc’s [+ _ 4] form, though allows for more than one argument. The standard lambda form is also similar to Arc’s:

  (map (fn [x] (+ x 4)) '(1 2 3)
   -> (5 6 7)

And this is the reddit link: http://www.reddit.com/r/programming/comments/75p8f/cool_thin...

-----

3 points by almkglor 5921 days ago | link

Anarki supports multiple arguments too:

  (map [* _1 _2] '(1 2 3) '(4 5 6))
Note that this is currently bugged in Arc-F though. Will fix ^^.

The auto-gensyms thing looks cute. It might be possible to hack something like that, although it would require modifying the axiomatic quasiquote operator.

Basically:

  `(let foo# ,foo
     (do-some foo# foo#))
=>

  (quasiquote (let (unquote-uniq foo) (unquote foo)
                (do-some (unquote-uniq foo) (unquote-uniq foo))))
Then quasiquote has to expand to scheme style:

  (let ((gensym012032 (gensym)))
    (quasiquote (let (unquote gensym012032) (unquote foo)
                  (do-some (unquote gensym012032) (unquote gensym012032)))))
The recur bit is a lot like (afn () ... self)

-----

3 points by stefano 5921 days ago | link

The big difference is in the implementation: access to the JVM is just great.

-----

3 points by andreyf 5920 days ago | link

Programming languages are things understandable by brains and executable by computers. In the long run, the interface to the latter will change as computer architectures change. What PG is looking for with Arc (I think) is the optimal interface to the former.

-----