如何仅显示方案

时间:2018-03-11 00:45:58

标签: scheme racket

(display '(a b c))返回(a b c),但我正在寻找一个以'(a b c)作为参数并显示a b c的过程。这可能吗?

1 个答案:

答案 0 :(得分:1)

这是一个符号列表,它有一个标准表示:'(a b c)。如果你想摆脱周围的(),我们必须将元素作为字符串来操纵,例如:

(display              ; finally, display the string
 (string-join         ; join the strings using a space as separator
  (map symbol->string ; convert each symbol to a string
       '(a b c))))    ; this is a list of symbols

它会打印:

a b c