▲ | z_open a day ago | |||||||
printf("x = %6d\ny = %.8E\n", x, y) ; What's the equivalent lisp? | ||||||||
▲ | mrcode007 a day ago | parent | next [-] | |||||||
(format t "x = ~6d~%y = ~.8E~%" x y) | ||||||||
▲ | taeric a day ago | parent | prev | next [-] | |||||||
The "format string" capabilities of common lisp are quite advanced. https://gigamonkeys.com/book/a-few-format-recipes is a fun overview. | ||||||||
| ||||||||
▲ | rscho a day ago | parent | prev | next [-] | |||||||
You seriously thought that lisps had no printf equivalent ?! | ||||||||
| ||||||||
▲ | zck a day ago | parent | prev [-] | |||||||
Someone else has given you the Common Lisp version. Here's one for Clojure:
If I've understood everything right, and your example is in C, the format string in Clojure is identical to the one in your comment. |