Arc Forumnew | comments | leaders | submitlogin
2 points by absz 6510 days ago | link | parent

Not quite. (car x) is treated specially as well, albeit slightly differently. If (car x) were evaluated, then the result would be more along the lines of (let temp (car x) (= temp 'z)), which would result in (car x) not actually changing. What happens is that = examines the first argument, and takes different action depending on whether or not it's a symbol (straight assignment) or not; if it's something else, it takes special action, like assigning the car in that case.


4 points by pg 6509 days ago | link

What happens to the first argument is called inversion; = has to figure out where to put the value. And that could involve some evaluation, e.g. if you said

  (= (x y) 10)
Arc would have to evaluate y to figure out where in x to put the 10. So I should probably change the tutorial.

-----

2 points by quagmale 6510 days ago | link

Oh I see. Thank you for clarification.

It seems like (=) is a very special function. I'm not sure if I can even call it a function. Like, other functions can be passed as a value. But (=) doesn't seem like a function that can be passed around as a value.

-----

5 points by pg 6509 days ago | link

= is actually a macro; it works by transforming expression in which it occurs first.

-----