The latest arc doesn't seem to offer a way to coerce real or complex numbers from a string - the title example raises an error (it didn't previously). Given that 'num is a standard arc type, it seems fair to allow coercion from string to num. From (xdef coerce ...) in ac.scm: ((string? x) (case type
((sym) (string->symbol x))
((cons) (ac-niltree (string->list x)))
((int) (let ((n (apply string->number x args)))
(if n
(iround n)
(err "Can't coerce" x type))))
+ ((num) (let ((n (apply string->number x args)))
+ (if n
+ n
+ (err "Can't coerce" x type))))
(else (err "Can't coerce" x type))))
Now, (coerce "3.14" 'num)
and (coerce "3+4i" 'num)
both work.Of course (read "3.14") is a workaround, but it still seems wrong that 'coerce isn't doing this. |