[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

string mapping gotcha



I just finished a rather entertaining debugging session, chasing the
source of this error:

ERROR: No applicable methods error when calling #{Gen fab-elt-setter ((v
<any>) (x <col>) (k <any>))} on (a "   " 0)

Eventually, I discovered that (unlike Python, the language i've been
using most) mapping over strings returns a string, not a list, and
returning a non-character from the mapping function (for example,
(map (fun (x) 'a) "foo")) results in the above error. This certainly
seemed to violate the law of least astonishment: even if returning the
same type of collection is the Right Thing, the error message could use
some clarification. :)

-- 
Allen Short        Programmer-Archaeologist       
washort@twistedmatrix.com
<demoncrat> I think nowadays sisyphus would have to reinstall windows
all the time