Verify that an OCaml function is tail-recursive
How can I tell if OCaml recognizes a particular function as tail-recursive? In particular, I want to find out if the OCaml compiler recognizes Short-circuited operators and tail recursion Thanks to Jeffrey's answer below, I tried this with the simple function let rec check_all l = match l with | [] -> true | hd :: tl -> hd && check_all tl and indeed, it does optimize to: camlTest__check_all_1008: .cfi_startproc .L102: cmpl $1, %eax je .L100 movl (%eax), %ebx cmpl $1, %ebx je .L101 movl 4(%eax), %eax jmp .L102 .align 16 .L101: movl $1, %eax ret Starting from OCaml 4.03, and despite the typo in