Arc Forumnew | comments | leaders | submitlogin
3 points by conanite 5641 days ago | link | parent

oops ...

  arc> (coerce "foo" 'num)
  #f
I think this should be

  arc> (coerce "foo" 'num)
  Error: "Can't coerce \"foo\" num"
The fix for http://arclanguage.org/item?id=9450 in ac.scm seems to be missing the guard clause for the case where the string is not parsable as a 'num

  ((string? x)    (case type
                  ((sym)    (string->symbol x))
                  ((cons)   (ac-niltree (string->list x)))
;; -> num needs to be checked same way as 'int in the subsequent clause

                  ((num)    (apply string->number x args)) 

                  ((int)    (let ((n (apply string->number x args)))
                              (if n 
                                  (iround n)
                                  (err "Can't coerce" x type))))
                  (else     (err "Can't coerce" x type))))


3 points by pg 5641 days ago | link

Yes, you're right. It's now fixed in arc3.tar.

-----