(setq *print-circle* T)
;; then create some list with a large number of items, of which a bunch
;; of them repeat
If you then try to print the list in the repl, you will see a lot of unfamiliar text. Each of your items (in the beginning) will show a #1 or #2, etc, depending on the items location in your list. Where the list repeats itself, instead of the item printing out, you will have a #1# #2#, etc, depending on which item it the list it is a repeat of. This threw me, because I wasn't expecting it. I'm not sure if there is a way to mark a list so it won't do this behaviour when you print the object in the repl.
(setq *print-circle* T)
;; then create some list with a large number of items, of which a bunch
;; of them repeat
If you then try to print the list in the repl, you will see a lot of unfamiliar text. Each of your items (in the beginning) will show a #1 or #2, etc, depending on the items location in your list. Where the list repeats itself, instead of the item printing out, you will have a #1# #2#, etc, depending on which item it the list it is a repeat of. This threw me, because I wasn't expecting it. I'm not sure if there is a way to mark a list so it won't do this behaviour when you print the object in the repl.
Share Improve this question asked Nov 20, 2024 at 1:03 JEPriceJEPrice 7131 gold badge7 silver badges10 bronze badges1 Answer
Reset to default 0Nothing has been modified in the list, just the way it was represented was changed.
The way I worked around it is to defun a function to concatenate the list items in a single string, this forced an expansion of the list items.
(defun join-list-items( list )
"joins all items in a list as one big string"
(format nil "~{~a~}" list))
This isn't really a question, more of a warning that "here there be dragons" if you're unfamiliar with how SBCL handles the repl printing of a list that has duplicate items, if print-circle is set.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742387546a4434360.html
评论列表(0条)