【问题标题】:LISP: Join multiple lists but not flattenLISP:加入多个列表但不展平
【发布时间】:2012-11-19 23:30:27
【问题描述】:

我有

(setq a '(0 1))
(setq b '(3 4))
(setq c '(6 8))

我希望将x 输出为:

((0 1)(3 4)(6 8))

请指教。

【问题讨论】:

  • 通常建议在绑定中思考,而不是在分配中思考。说(let ((a '(0 1)) (b '(3 4)) (c '(6 8))) #|something that returns the joint lists|#)

标签: list lisp common-lisp flatten


【解决方案1】:

哇错过了一些非常基本的东西!

(setq x (list a b c))

【讨论】:

  • 或者:`(,a ,b ,c)(cons a (cons b (cons c '()))) :-)
猜你喜欢
  • 1970-01-01
  • 2014-11-10
  • 2013-11-06
  • 2015-11-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多