Arc Forumnew | comments | leaders | submitlogin
4 points by dreish 5875 days ago | link | parent

Although this does bring up an unfortunate characteristic of 'is':

  arc> (is 0 0.0)
  nil
It might be nice to have an == that does a numeric comparison, if floats and ints are always going to be considered unequal by 'is'.


2 points by tokipin 5875 days ago | link

in the meantime i have devised a clever scheme i call "natural coercion":

  arc> (with (x 0 y 0.0)
          (is (+ x 0.0) (+ y 0.0)))
  t
it can be toolified as:

  (def eq args
      (apply is (map [+ _ 0.0] args)))

-----

2 points by eds 5875 days ago | link

I would have expected 'iso to work for that, but it also returns nil.

  arc> (iso 0 0.0)
  nil

-----

1 point by sacado 5874 days ago | link

You're right. This is really strange as 0.0 is considered as an 'int.

-----

3 points by rincewind 5874 days ago | link

This may be related to http://arclanguage.org/item?id=5720

-----

1 point by sacado 5874 days ago | link

Hmmm... very possible...

-----