Je le code suivant:Elm: Comment se connecter dans un 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
Je voudrais enregistrer les valeurs de a
et b
à l'intérieur du foldl
. J'ai essayé:
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
Cependant, cette lance une erreur
I am looking for one of the following things:
a closing paren ')'
whitespace`
Qu'est-ce que je fais mal, et comment puis-je enregistrer les valeurs à l'intérieur foldl
?
Cela a fonctionné un régal. À votre santé! – Rich