Gyepi Sam
Interning Strings in Common Lisp

In a recent Common Lisp project, I needed to read a string and and call a corresponding function of the same name (in a dispatch table), essentially mapping a string to a function.

I initially tried (intern "string") which worked fine but the return value did not correspond to a symbol named string.

Turned out that intern does not work quite the same as the reader, which usually uppercases input symbols (but only as a convention). The work around (intern (string-uppercase "string")) worked, but had a funny smell. I later ran across a comment in another project that the workaround fails for some Lisp implementations.

Later on, I came across the aptly named read-from-string function, which does exactly what I needed! Since it uses the reader, it “just works”. The moral of the story is probably to look a little harder for the documentation!