Arc Forumnew | comments | leaders | submitlogin
2 points by rntz 5630 days ago | link | parent

There's a bug in your updated '+. It uses scheme's 'list? to check whether a given argument is a list to be converted - but 'list? only returns #t on proper lists (those that end with ()), and arc lists end with 'nil. So, for example:

    arc> (+ "" '(foo))
    Error: "Can't coerce to string (foo . nil)"
A simple solution is to change the use of list? to pair?, since 'nil and '() are both handled earlier in the cond expression.

Also, having a 'coerce-string function for coercing arguments to '+ to strings and not using it in 'coerce seems odd - if (+ "" x) and (coerce x 'string) behave differently, that's just unintuitive complexity, and if they behave the same, then some common code should be factored out.



1 point by pg 5629 days ago | link

Thanks, both fixed in the latest arc3.tar.

-----