Arc Forumnew | comments | leaders | submitlogin
1 point by akkartik 4206 days ago | link | parent

This is a super neat rewrite of the original. I don't have have much to contribute in response except tangents.

1. I didn't pay attention to your implementation earlier, but this is insane:

  (list (pop ops) (pop (cdr prefix)) (pop prefix))
How the heck does this work? I replace cdr.prefix with just prefix and it works fine except that it reverses the order of the operands.. Ooh, I see:

  arc> (= x '(1 2 3))
  (1 2 3)
  arc> (pop cdr.x)
  2
  arc> x
  (1 3)
Mind.. blown. Of course, it makes sense with hindsight.

Still, way too clever for my taste to rely on arg eval order. I'd rather make the ordering of mutations explicit:

  (withs (b pop.prefix
          a pop.prefix)
    (push (list pop.ops a b) prefix))
(with would still rely on arg eval order, I think.)

2. "Still think prefix does just fine.."

Absolutely. I'm not sure infix is worthwhile, just mildly dissatisfied by how arithmetic expressions in lisp turn out.

3. It turns out David Wheeler has thoroughly thought through the various scenarios for infix precedence: http://sourceforge.net/p/readable/wiki/Precedence. I haven't digested it yet.

4. "poly is too specific."

Yes, I was being lazy. I imagined poly without operator parameters:

  (poly q.q 2.p.q)
5. "Emphasis on _an_ operator, not a pair of them (lest it read like 'distribute addition over multiplication')."

That was incredibly useful in following your comment.

6. Can I prevail on you to switch from zero to zero?? :)



2 points by fallintothis 4206 days ago | link

I don't have have much to contribute in response except tangents.

Well, birds of a feather...

1. Still, way too clever for my taste

Oh, certainly. It was a result of me golfing an earlier version. :)

6. Can I prevail on you to switch from zero to zero??

In a heartbeat. I wish Arc used question marks (judiciously, mind you; don't need names like Scheme's char<?). But it doesn't, so I kowtow to its conventions.

-----