0
1 (use-modules (ice-9 rdelim))
2
3 (define (show l) (display l))
4
5 (define (read-two-lines)
6 (let ((count (read-line))
7 (l (read-line)))
8 (show l))) ; or (show count)
9
10 (read-two-lines)
上面的代碼無法將第二行讀入l。相反,它只是讀取相同的值的兩倍: -在線讀取不會讀取下一行
[email protected](guile-user)> (load "test.scm")
line1
line2
line1
當一號線,然後2號線是作爲輸入它顯示的LINE-1輸出,而不是2號線。這裏發生了什麼?
是讓*工作。但是,(顯示計數)和(顯示l)僅顯示第一行。 – Himanshu