尝试调用函数时收到以下错误," columnHasStreak"使用REPL:
错误FS0039:类型' KeyValuePair'未定义
我正在尝试使用REPL运行以下代码:
模块TicTacToe
open FsUnit
open NUnit.Framework
open System.Collections.Generic
[<Test>]
let ``some test to help me learn F#`` () =
let columnHasStreak (column : list<KeyValuePair<int,bool>>) =
column |> Seq.forall (fun cell -> cell.Value)
let cells = [0..8]
let connectCount = 3;
let columns = [0..2];
let grid = [for cell in cells -> (cell, true)]
|> Map.ofSeq
let rowLocations = grid
|> Seq.chunkBySize connectCount
|> Seq.toList
let columnLocations = [for i in columns -> rowLocations|> List.map (fun row -> row.[i])]
let allColumnsHaveStreak = [for i in columns -> columnLocations.[i]]
|> Seq.forall (fun column -> column |> columnHasStreak)
有人可以向我解释为什么我收到此错误吗?
答案 0 :(得分:0)
我的VS中没有出现此错误。也许您还没有将开放的System.Collections.Generic行发送到F#interactive window