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

OCaml initializing list in loop for

$
0
0

I am a beginner with OCaml. I would like to skip the first element of my list.

Here is my list:

let l = [1;2;3;4;5;6;7;2;1];;

I want to use this in my FOR:

let l = List.tl l;

here is my full code:

let l = [1;2;3;4;5;6;7;2;1];;let n = 1;;let counter = ref 0;;for i = 0 to (List.length l) do  if List.hd l = n then counter := !counter + 1;  print_int(!counter);  print_string("\n");  let l = List.tl ldone;;

But I have errors in the DONE and it says syntax error.


Viewing all articles
Browse latest Browse all 595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>