Arc Forumnew | comments | leaders | submitlogin
3 points by rntz 5815 days ago | link | parent

You can't use "foo(bar)" to call foo on bar in arc, you have to say "(foo bar)". Interpreting "dot((list 0 -1 1) 0.3 0.3)", Arc first evaluates 'dot (doing nothing) and then evaluates ((list 0 -1 1) 0.3 0.3), which calls the newly created list '(0 -1 1) on the two arguments 0.3 and 0.3, which in turn causes an error because it's trying to get the 0.3rd element from the list, which makes no sense. (Also it's been given two arguments when it expects only one.) This is a case of Arc not having very informative error messages.

Also, I think there's an error in the 'dot function, as you use a '+ where it will do nothing. Arc has no infix math, so what you want is something like this:

    (def dot (g x y)
      (+ (* (g 0) x) (* (g 1) y)))
    
    (dot (list 0 -1 1) 0.3 0.3)


1 point by bOR_ 5815 days ago | link

arg. that's a silly error of mine. I translated the program from ruby, and that one must have slipped.

-----