附加列表以在Racket中的文本字段%中显示

时间:2017-10-24 03:57:47

标签: list scheme lisp racket

我有一个函数接收一个字符串列表,名为" derivedSentences"需要在文本字段中显示。

(for-each (lambda (singlesentence)
          (send derivationPanelTextField set-value singlesentence)
               ) derivedSentences)

然而,就像这样,每次循环时,它只是替换之前的内容,因此只显示最后一个字符串。但是我试图让它逐步显示,所以我需要不断地在循环的每次迭代中附加字符串,但无论我尝试什么都不起作用。它是一个错误,或者文本字段显示为空白。

1 个答案:

答案 0 :(得分:0)

如果无法从文本字段中查询文本,您仍然可以在字符串变量中累积文本。

(let ((text ""))
  (for-each
   (lambda (singlesentence)
     (set! text (string-append text singlesentence))
     (send derivationPanelTextField set-value text))
   derivedSentences))
相关问题