Arc Forumnew | comments | leaders | submitlogin
Possible bug in if?
1 point by alexpogosyan 4579 days ago | 2 comments
I'm using arc version 3.1 on mzscheme 4.2.5.

This example works properly:

  arc> (def f (x) (if (> x 0) 1 (< x 0) -1 0))
  arc> (list (f 1) (f 0) (f -1))
  (1 0 -1)
But if we change conditions a bit it doesn't work anymore, or maybe I'm missing something:

  arc> (def f (x) (if (= x 0) 0 (< x 0) -1 1))
  arc> (list (f 1) (f 0) (f -1))
  (0 0 0)


7 points by Pauan 4579 days ago | link

"=" is used for assignment, not equality. Use "is":

  (def f (x) (if (is x 0) 0 (< x 0) -1 1))

-----

1 point by alexpogosyan 4579 days ago | link

Thank you!

-----