如何并排打印LISP列表?

Nab*_* kc 1 lisp common-lisp

我有两个列表

(defvar product-list (list "apple" "banana") )
(defvar price-list (list 5 10) )
Run Code Online (Sandbox Code Playgroud)

我想打印出来

苹果:5

香蕉:10

这该怎么做 ?

Ale*_*nko 5

你可以使用循环,例如:

(defvar product-list (list "apple" "banana") )
(defvar price-list (list 5 10) )

(loop for product in product-list
      for price in price-list
      do (format t "~A : ~A~%"
                 product
                 price))
Run Code Online (Sandbox Code Playgroud)