Thông tin

Hạn chót Không có hạn chót
Giới hạn nộp bài Không có giới hạn

Đăng nhập

[6.20] Recherche [5min]

Définissez une fonction répondant à la spécification suivante :

\begin{align*} & \text{Nom} & & \texttt{recherche x xs} \\ & \text{Type} & & \texttt{Eq a => a -> [a] -> Maybe a} \\ & \text{Conditions} & & / \\ & \text{Résultat} & & \texttt{Just e} \text{ où } e \text{ est le premier élément de } xs \text{ égal à } x \text{ si } x \text{ apparaît dans } xs; \\ & & & \text{sinon, } \texttt{Nothing} \end{align*}
ATTENTION!
Les fonctions demandées doivent être implémentées en utilisant foldr et/ou foldl, sans récursivité explicite.

Le code