A (relatively) frequently asked question on comp.lang.lisp is "What's the equivalent to scanf()?". The usual answer is "There isn't one, because it's too hard to work out what should happen". Which is fair enough.
However, one year Christophe was bored during exams, so he wrote format-setf.lisp, which may do what you want.
It should be pointed out that currently the behaviour of this program is unspecified, in more senses than just the clobbering of symbols in the "CL" package. What would be nice would be to see a specification appear for its behaviour, so that I don't have an excuse when people say that it's buggy.
Quick assessment (2023-03-24)
- Tested with CCL, MKCL, and Allegro CL.
- Appears to work for the most obvious things.
- Includes atof.cl from the CMU AI Repository.
- Allegro CL balks because of a package lock.
For example:
correctly parses the string into x and y, whereas
fails because we used the wrong format directive.
Text