Arc Forumnew | comments | leaders | submitlogin
4 points by shader 3914 days ago | link | parent

This was just sent to me by a friend. I'm wondering what everyone else's take on this flavor is.

It would be interesting in seeing other examples of the same functions for comparison in e.g. wart, etc.

Also, here's my take on the first few in arc:

  (for x 1 10
    prn.x)

  (map [prn _] '(1 2 3 4 5 6 7 8 9 10))

  (def f (n)
    prn.n
    (if (< n 10) (f:+ n 1)))
  (f 1)
 
To me, the arc looks better, though I may just be biased. The syntax is probably more confusing at first glance for a newcomer.


1 point by akkartik 3914 days ago | link

Wart isn't that different from arc, it still shows its roots.

  for x 1 (x < 10) ++x
    prn x

  map prn '(1 2 3 4 5 6 7 8 9 10)

  def (f n)
    prn n
    if (n < 10)
     (f n+1)
  f.1
Unlike smile it needs those parens around the if condition.

Edit 13 hours later: Ack, I was wrong. Wart would drop the parens just fine!

  if n < 10
   (f n+1)
I'm not sure I like it, but the design of infix fundamentally supports it by having higher precedence than function calls. If the infix operands grow complex it can get hard to read without parens.

  if (function-call n x1 x2 x3) < 10
    (f n+1)
  # still works, but yuck..

-----

1 point by akkartik 3914 days ago | link

Rather than compare it to arc, I found it tantalizing to think about how I'd implement that syntax. It looks like he's built objects for modules/namespaces, ranges, etc. But he's somehow supporting infix without spaces and also names like print-line. How does it work?! :)

Edit 8 minutes later: Also, the square brackets around the call to [f 1] are strange. If they're mandatory, there's something there I don't follow.

-----

2 points by shader 3914 days ago | link

Interesting direction to take it. It would be interesting to know how he implemented it, so that he can still consider it to be a lisp. In particular that '#include' syntax sticks out a bit.

I also found it ironic how conflicted he is over its relationship with lisp.

-----