I just saw the answer of Sylwester to this question, and I thought strange that the loop has colons everywhere.
Usually, I would write
(loop for n below 10 do (princ n) (terpri))
instead of
(loop :for n :below 10 :do (princ n) (terpri))
After some tests, I see that with the first loop, the symbols for, below and do are then part of cl-user (edit : actually not do, only the other two, probably because do is also a macro in the cl package), not with the second. Likewise, a 'X alone will then be part of cl-user, not ':X. The symbol-package function tells me the latter is in the keyword package.
Now, the first loop, without colons, looks much prettier to me, so I would like to know if the preceding remarks are a good reason to use the second one instead. That the symbols become "included" in the current package looks rather inoffensive, but maybe I have overlooked the consequences.
Any idea?
You moslty already answered your own question, the difference is as you described. :some-symbol will be in :KEYWORD package, and 'SOME-SYMBOL will be in your current package CL-USER by default. In loop macro it's just a matter of taste. Some people prefer to use :for notation to get better syntax highlighting in their text editor, for example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With