2014-11-03 68 views

回答

11

请阅读“理论”here

简单地说,你可以绑定multiple valuesmultiple-value-bind

(multiple-value-bind (val pos) (parse-integer "12 3 6" :start 0 :junk-allowed t) 
    (list val pos)) 
==> (12 2) 

您还可以setf多个values

(setf (values val pos) (parse-integer "12 3 6" :start 0 :junk-allowed t)) 
val ==> 12 
pos ==> 2 

参见VALUES Forms as Places

PS。在你的具体情况下,你可能只是做

(read-from-string (concatenate 'string 
           "(" 
           "12 3 6" 
           ")")) 

并获得列表(12 3 6)。 尽管这不是最有效的方式(因为它分配了不必要的内存)。

PPS参见:

  1. How to convert a string to list using clisp?
  2. In lisp, how do I use the second value that the floor function returns?