在 F# interactive 中,如何从 List.map 获取 [<fun:Invoke@3233>] 的结果?
In F# interactive, how to get the results of [<fun:Invoke@3233>] from List.map?
新手 F# 问题总数。
2019年Visual studioF#交互文件,我有:
open System
module Visit =
type Model =
{
Id: int
Name: string
}
let init col cel =
{
Id = col*100 + cel*10 + 1
Name = sprintf "My Name is col: %d cel: %d" col cel
}
let getName m = m.Name
module Cell =
type Model =
{
Id: int
Visit: Visit.Model
}
let init col cel =
{
Id = col*10 + cel
Visit = Visit.init col cel
}
let getVisit (m:Model) = Visit.getName m.Visit
module Column =
type Model =
{
Id: int
Appointments: Cell.Model list
}
let init =
{ Id = 0
Appointments = [0 .. 3] |> List.map (Cell.init 0) }
let findAppointment m =
m.Appointments |> List.map ( fun cell -> Cell.getVisit)
// m.Appointments |> List.map ( fun cell -> printfn "%A" cell; cell.Id)
let find =
init |> findAppointment
我得到:
val 查找:(Cell.Model -> 字符串)列表 =
[fun:Invoke@3233; fun:Invoke@3233; fun:Invoke@3233;
fun:Invoke@3233]
如何在列表中获取实际的名称(字符串)函数结果(不是 [fun:Invoke@...),...]???
TIA
罪魁祸首是 Cell.getVisit
未应用于单元格,即它应该是
m.Appointments |> List.map (fun cell -> Cell.getVisit cell)
或
m.Appointments |> List.map Cell.getVisit
新手 F# 问题总数。
2019年Visual studioF#交互文件,我有:
open System
module Visit =
type Model =
{
Id: int
Name: string
}
let init col cel =
{
Id = col*100 + cel*10 + 1
Name = sprintf "My Name is col: %d cel: %d" col cel
}
let getName m = m.Name
module Cell =
type Model =
{
Id: int
Visit: Visit.Model
}
let init col cel =
{
Id = col*10 + cel
Visit = Visit.init col cel
}
let getVisit (m:Model) = Visit.getName m.Visit
module Column =
type Model =
{
Id: int
Appointments: Cell.Model list
}
let init =
{ Id = 0
Appointments = [0 .. 3] |> List.map (Cell.init 0) }
let findAppointment m =
m.Appointments |> List.map ( fun cell -> Cell.getVisit)
// m.Appointments |> List.map ( fun cell -> printfn "%A" cell; cell.Id)
let find =
init |> findAppointment
我得到:
val 查找:(Cell.Model -> 字符串)列表 = [fun:Invoke@3233; fun:Invoke@3233; fun:Invoke@3233; fun:Invoke@3233]
如何在列表中获取实际的名称(字符串)函数结果(不是 [fun:Invoke@...),...]???
TIA
罪魁祸首是 Cell.getVisit
未应用于单元格,即它应该是
m.Appointments |> List.map (fun cell -> Cell.getVisit cell)
或
m.Appointments |> List.map Cell.getVisit