Arc Forumnew | comments | leaders | submitlogin
1 point by waterhouse 5411 days ago | link | parent

I've noticed that making names with + in them doesn't work the way it should. Including in the release of arc3 that I downloaded ten minutes ago, just to check if it was still there.

  arc> (def 1+ (x) (+ x 1))
  #<procedure: 1+>
  arc> (1+ 2)
  Error: "Function call on inappropriate object 1 (2)"
  arc> 1+
  1
  arc> (def one-plus (x) (+ x 1))
  #<procedure: one-plus>
  arc> (one-plus 2)
  3
As you can see, when I changed the name but left everything else the same, it worked. Therefore, the name is the problem. Here is another example.

  arc> (mac ++mod (n m (o d 1)) `(= ,n (mod (+ ,n ,d) ,m)))
  #3(tagged mac #<procedure>)
  arc> ++mod
  #<primitive:modulo>
  arc> (= x 1)
  1
  arc> (++mod x 5 10)
  Error: "modulo: expects 2 arguments, given 3: 1 5 10"
  arc> (mac inc-mod (n m (o d 1)) `(= ,n (mod (+ ,n ,d) ,m)))
  #3(tagged mac #<procedure>)
  arc> inc-mod
  #3(tagged mac #<procedure>)
  arc> (inc-mod x 5 10)
  1


1 point by thaddeus 5411 days ago | link

I don't think this is a bug, I think it's a sacrifice pg is making for the sake of using the '+' as a special operator.

Only he can say for sure.

I've just substituted all my '+' names to 'up' and, in my mind, it's just as meaningful.

ie upmod or modup .....

-----

0 points by rs 5407 days ago | link

correcto!

-----