Reputation: 140
Hi my following code gives a "Syntax Error" and i have no idea why...
Any basic mistake you can see?
(* ajouter_itineraire: itineraire -> plan -> plan *)
let ajouter_itineraire (i: itineraire) (p: plan) = match p with
| Vide ->[i]
| Ilist l ->if itineraire_existe(i.num) then
Err("Itineraire deja present") else i::p.Ilist
Err is an exception taking a string as parameter.
Upvotes: 0
Views: 100
Reputation: 66803
Your code tries to return the exception as a value. I think you want to say raise (Err "Itineraire deja present")
. Also p.Ilist
looks wrong. Most likely this should be just l
.
Upvotes: 2