3 ms·
Format is pretty much a language unto itself. That's why it's one of the few entries in CLHS that gets linked chapters. If Lisp was more popular, format would
by ksaj 4y ago
Format is pretty much a language unto itself. That's why it's one of the few entries in CLHS that gets linked chapters.
If Lisp was more popular, format would be an excellent topic for a big fat reference book, since it can do so much more than you'd expect a print statement to do.
When I was in grade 11, we were tasked with writing a program, in our language of choice (that they'd taught us), to convert a decimal number into a roman numeral.
I get that the exercise was to teach about the process of doing it manually, and coding it that way. But Lisp was one of the languages they introduced us to. No modulus, loops or ifs needed - format will happily do this for you in a simple format string.
I still got the marks, but the teacher was on the fence about whether I deserved it or not. We regularly did base translations in C. It's just that Lisp has this one extra trick up its format sleeve, and Byte Magazine told me about it.