Information

Deadline Καμία προθεσμία
Submission limit No limitation

Συνδεθείτε

[5.8 - 5.9] Function [Suppl.]

Définissez la fonction répondant aux spécifications suivantes :

\begin{align*} & \text{Nom} & & \texttt{function xs ys x} \\ & \text{Type} & & \texttt{Eq a => [a] -> [b] -> a -> Maybe b} \\ & \text{Conditions} & & \texttt{length xs == length ys}, \text{ tous les éléments de } \texttt{xs} \text{ sont différents.} \\ & \text{Résultat} & & \text{si } \exists i \text{ tq } \texttt{(xs!!i == x)}, \text{ renvoie } \texttt{Just ys!!i} \\ & & & \text{sinon, renvoie } \texttt{Nothing} \end{align*}

Question 1: Le code
Question 2: Comment utiliser la fonction de l'exercice précédent pour définir des fonctions à domaine fini ?