Re: Where did my thinking take the wrong turn
| Newsgroups | gmane.comp.lang.ocaml.beginners |
|---|---|
| Organization | University of Mons |
| Message-ID | <20141105.204955.2111147478444542222.Christophe.Troestler@umons.ac.be> |
Hi, On Wed, 5 Nov 2014 20:18:23 +0100, Roelof Wobben [email protected] [ocaml_beginners] wrote: > > Sorry for asking so much but I still have problems with the easy > task of > the 99 Ocaml problems. > > I now have to revert a list. > > I have this : > > let reverse list = > let rec reverse2 list2 acc = > match list2 with > | [] -> acc > | x::xs -> reverse2 (x::acc) xs The order of arguments matters. Take a piece of paper and compute manually (taking great care of the details) the recursive calls of « reverse2 [1;2;3] [] ». > in reverse2 list [] ;; Best, C.