top | item 44683824

(no title)

z_open | 7 months ago

printf("x = %6d\ny = %.8E\n", x, y) ;

What's the equivalent lisp?

discuss

order

mrcode007|7 months ago

(format t "x = ~6d~%y = ~.8E~%" x y)

rscho|7 months ago

You seriously thought that lisps had no printf equivalent ?!

Jtsummers|7 months ago

People still think that Lisps only offer lists for data structures, which hasn't been true since at least 1960.

zck|7 months ago

Someone else has given you the Common Lisp version. Here's one for Clojure:

  (printf "x = %6d\ny = %.8E\n" x y)
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.