我有以下代碼中:榆樹:如何登錄一個與foldl
findPerson name peeps = List.foldl
(\a b -> case b of
Just _ -> b
Nothing -> if a.name == name then
Just a
else Nothing
) Nothing peeps
我想記錄的foldl
內的a
和b
值。我已經試過:
findPerson : String -> List Person -> Maybe Person
findPerson name peeps = List.foldl
(\a b ->
Debug.log(a)
Debug.log(b)
case b of
Just _ -> b
Nothing -> if a.name == name then
Just a
else Nothing
) Nothing peeps
然而,這將引發錯誤
I am looking for one of the following things:
a closing paren ')'
whitespace`
什麼我做錯了,我怎麼可以登錄內部foldl
值是多少?
這工作的一種享受。乾杯! – Rich