我的下一個項目是編寫一個hang子手遊戲。我想這會幫助我刷新字符串和文件I/O。從文件返回單詞列表
目前,我堅持閱讀字符串文件到列表中。我試圖避免全局變量,所以有人指出我在正確的方向將此(可能是破碎的)代碼轉換爲返回列表的函數?
(defun read-word-list()
"Returns a list of words read in from a file."
(let ((word-list (make-array 0
:adjustable t
:fill-pointer 0)))
(with-open-file (stream #p"wordlist.txt")
(loop for line = (read-line stream)
while line
(push line word-list)))
(select-target-word word-list)))))
問題的標題與問題的文字相關的標題如何? – 2010-11-08 07:08:08
我開始問一個問題,轉到另一個問題,忘記改變它。哎呦。 – Andy 2010-11-08 14:31:57