let csvList startDelim endDelim lst memF =
let listIter (listStr: string) item =
if listStr.Length > 0 then
listStr + "," + (memF item)
else
memF item
startDelim + (List.fold listIter "" lst) + endDelim
let listIntoJsonArray = csvList "[" "]"
let listIntoJsonObject = csvList "{" "}"
let intConverter (item:int) : string =
item.ToString()
let objectConverter (item:SomeObject) : string =
item.value.ToString()
let objects = [{vaue: 12.3}; {vaule: 33.2}]
let ints = [1;2;4]
let o = listIntoJsonObject objects objectConverter
let i = listIntoJsonObject ints intConverter
我似乎找不到使 csvList 或其部分应用的助手 listIntoJsonArray 或 listIntoJsonObject 通用的魔法酱。
谢谢您的帮助。