juri•

One nice thing about format-style functions is that they make i18n somewhat easier, especially if they support named or indexed replacements (like "foo: %(foo)s" or "foo: {1}", that is.)

8
deathOP•

While that may be somewhat true in other languages, in Lisp you can just store the form (or function :) that formats the string instead.

6
randallsquared•

Common Lisp's FORMAT, however, has stuff that's positively anti-i18n.

Case conversion, which doesn't even make sense for some charsets; automatic pluralizing, which is useful only in English text and perhaps a few other European languages with the 's' pluralization method; built in conversion to specifically english text for numbers using ~R...

6
hoijarvi•

Definitely. The writer considers (out "x = " x ", y = " y ", z = " z :%) better than a format string + arguments. It's the same mistake that C++ made by overloading <<

3
qwe1234•

i hate 'operator<<'.

it also managed to mess up templates for over a decade.

0†
adamc•

Worth reading if only for the history in the first few paragraphs.

3
qwe1234•

agree.

the rest is pure eye-bleach.

-6
happyhappyhappy•

printf-like functions are ugly in languages with intrinsic list and tuple support--especially dynamically typed languages--because you can easily use lists and symbols to structure the same formatting info. No need to pack everything into a string.

I do admit to liking true variable interpolation in strings, a la Perl. That's even shorter and more straightforward.

3
jimbokun•

The "out" macro reminds me a little bit of Lisp markup-outputting DSLs like CL-WHO.

http://weitz.de/cl-who/#example

3
notfancy•

A straightforward application of pretty-printing combinators defining a DSL. Like it.

1
qwe1234•

wow, a clear and unambiguous exposition of the degeneracy of the lisp 'mindset'.

-23
sketerpot•

You would probably think that the New York telephone book is a clear and unambiguous exposition of the degeneracy of the lisp mindset.

(Whereas lispers would look at the phone book and say "I bet I could parse this with cl-ppcre and stick it into a nice s-expression format! Then gzip it for space, I guess.")

2
qwe1234•

parsing something with regular expressions and sticking the result into an s-expression is by far the stupidest, most error-prone and inefficient way of parsing something.

read a compiler construction book, please.

-5