Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • As stated, I was just toying around with macros etc, to see what can be done with them(I still have a huge problem really grasping how macros work etc) and not trying to create anything usefull. All in the process of learning you could say. Commented Jun 26, 2014 at 16:56
  • 1
    Using format, as I mentioned in my answer, is not a great idea. If the printer capitalization is changed, then you get unexpected symbols. For a while I used to keep print-case set to capitalize so, e.g., (print 'foo) would print Foo. But that means that (format nil "~a-~a" 'foo 'bar) produces "Foo-Bar", which makes for the symbol |Foo-Bar|, which is rather inconvenient to type with the default upcasing reader behavior. Using symbol-name and concatenate is much more to produce readable/writable symbols. Commented Jun 26, 2014 at 19:52
  • I've added an example to the end of my answer that shows why you shouldn't use format here. Commented Jun 26, 2014 at 20:04
  • 1
    @JoshuaTaylor, good point. Also, it's not format per se that is wrong, it's ~a (or princ) with a symbol. If instead of the symbol we'd provide its name (with either symbol-name or string), it would be OK. Commented Jun 26, 2014 at 21:21
  • Yes, you can avoid many of the issues with format if you give the actual strings as arguments. However, if you want any alphabetic text added it, it gets trickier. E.g., (format nil "COPY-~a" ...) or (format nil "copy-~a" ...), etc. "COPY-~a" is the most likely to work well, but (format nil "~a-~a" (string 'copy) ...) will at least get you the name of whatever copy is read as. Commented Jun 26, 2014 at 21:47