On 19/11/2013 16:05, Jean Saint-Remy wrote: > The example code using pattern matching appears to be a "let rec" > short-circuit which I believe deserves a comment in the book. It > appears to be puzzling, we are binding a "zero" to the head of the > list in order to drop it? I think it is a fine example of OCaml that > should be encouraged, not just an isolated case. > > let rec drop_zero ls = match ls with > | [] -> [] > | 0 :: tl -> drop_zero tl > | hd :: tl -> hd :: drop_zero tl > ;; Hi, It isn't a « short circuit » : the list is pattern matched, and if it matches `0 :: tl`, then the result is `drop_zero tl`. The head of the list (0) is effectively dropped by not including it on the right hand side. And, as far as I know, it is rather idiomatic to use pattern matching in the way (when matching over suitable datatypes). Regards, Nicolas