Re: Where did my thinking take the wrong turn

"Christophe Troestler [email protected] [ocaml_beginners]" <[email protected]>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.