Re: reverse a list. is this a good solution

"Roelof Wobben [email protected] [ocaml_beginners]" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>
Sébastien Dailly
[email protected] [ocaml_beginners] schreef op
20-10-2014 20:47:

Le 20/10/2014 19:49, Roelof Wobben [email protected]
[ocaml_beginners] a

écrit :

> Yes, I noticed and I try to understand the difference
:

>

> I think you mean this function :

>

> let rec aux_rev l accum =

>

> DoI understand that this part in aux_rev[] takes care
of a empty acc ?

> I find this solution a little bit confusing
expecially the in part .

>

This is a very common pattern in the functionnal
programming.

It's a good usage in OCaml to give the maximum of safety
in the code,

and expose only what is necessary.

The solution given by Chingfan gives one function, with
the followin

pattern :

> let function1 arg1 =

> let function2 arg2 arg3 = …

> in function2 arg1 []

so in this case, the function2 is localy defined inside
function1, and

only function1 is visible from outside.

This allow to control how the data will be processed, and
to be sure to

get well-formatted arguments.

--

Sébastien

oke,

So if I understand it right then with let function2 arg2 arg3 = …
you say I have a function named function2 with two arguments and
with the in you say that one of the arguments is a empty list.

Roelof

__._,_.___

----------

Posted by: Roelof Wobben <[email protected]>
----------

Reply via web post

•

Reply to sender

•

Reply to group

•

Start a New Topic

•

Messages in this topic
(9)

Archives up to December 31, 2011 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners

The archives of the very official ocaml list (the seniors' one) can be found at http://caml.inria.fr

Attachments are banned and you're asked to be polite, avoid flames etc.

Visit Your Group

-
New Members
3

https://groups.yahoo.com/neo;_ylc=X3oDMTJkNmZnczExBF9TAzk3NDc2NTkwBGdycElkAzQ5OTkxOTQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxNDEzODMyODUx

• Privacy • Unsubscribe • Terms of Use

.

__,_._,___
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.