【发布时间】:2016-12-13 21:45:16
【问题描述】:
我可以有这样的功能:
let readLines (filePath:string) = [
use sr = new StreamReader (filePath)
while not sr.EndOfStream do
yield sr.ReadLine ()
]
但我不能有这样的功能:
let lines (f:string) =
let readLines (filePath:string) = [
use sr = new StreamReader (filePath)
while not sr.EndOfStream do
yield sr.ReadLine ()
] in readLines f
我得到错误:
Block following this 'let' is unfinished. Expect an expression.
我无法解决这个错误。我希望有一个来自“行”的字符串列表。
【问题讨论】:
-
尝试缩进右大括号(或删除
in并将readLines f放在下一行)。 -
您说的非常正确,先生,非常感谢。现在的问题是,为什么。
标签: list f# syntax-error