0

リスト内のアイテムに特定のスコアを与える関数を作成しました

(define newlist '((score 'A ) (score 'A1 ) (score 'A2 )))

しかし、( XYZ) list を返すことはできません。それだけ

'((score 23 ) (score 12 ) (score 7 )) これは、変数の置換値のみです。

4

3 に答える 3

0

When you use quote (the character ') what follows in not evaluated. So in what you provided, the entire list of three items is not evaluated. To evaluate use list as such:

  (define newlist (list (score 'A) (score 'A1) (score 'A2)))

As @kmoerman points out, there are other ways, using map, to get a valid result; however, your original problem was using quote instead of list.

于 2013-04-28T03:13:13.610 に答える
0
(define newlist `(,(score 'A) ,(score 'A1) ,(score 'A2)))
于 2013-04-28T12:34:59.717 に答える