我的代码有点问题,我写的是用于从F#中的控制台读取输入作为行序列.我的问题是它只读取5行文本然后结束但它应该读取更多行.如果有人告诉我这段代码有什么问题会很好.
let allList = new List<string>()
let rec readlines () = seq {
let line = Console.ReadLine()
let b = allList.Add(line)
if line <> null then
yield line
yield! readlines ()
}
let b = readlines()
printf "%A" b
Run Code Online (Sandbox Code Playgroud)