Forum de discussion pour l'UE Programmation Fonctionnelle en OCaML

fonction mapcan

fonction mapcan

Baya Saleck írta időpontban
Válaszok szám: 1

Bonjour,

ma fonction mapcan fonctionne quand je la teste sur emacs mais sur moodle ne marche pas et  je ne comprends pas pourquoi. Pourtant j'envoie une liste comme demander dans l'énoncée.  

Erreur de type ou fonction inexistante!

--------------------------------
Error: This expression has type int but an expression was expected of type
int list
--------------------------------
0/100
Cordialement,

Saleck BAYA

Válasz erre: Baya Saleck

Re: fonction mapcan

Durand Irene írta időpontban
Ta fonction ne répond pas du tout à la spécification. Voici un exemple:

utop[2]> mapcan (fun x -> [x; x * x]) [1; 2; 3];;
- : int list = [1; 1; 2; 4; 3; 9]

ta fonction donne:
- : int list list = [[1; 1]; [2; 4]; [3; 9]]