Quantcast
Channel: Active questions tagged ocaml - Stack Overflow
Viewing all articles
Browse latest Browse all 531

Difficulties with Ocaml. Lists

$
0
0

I wrote this function which was supposed to give me the before last element of a list, but it doesn't work? Do you know why? thanks!

let rec exo1= match l with  |List.length l = 0 or 1 -> failwith exo1  |List.length l > 2  -> List.tl l in exo1 l  |List.length l = 2 -> List.hd l ;;

Viewing all articles
Browse latest Browse all 531

Trending Articles