Re: last item. no output

"Roelof Wobben [email protected] [ocaml_beginners]" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>
Matthieu Dubuget
[email protected] [ocaml_beginners] schreef op 18-10-2014
17:44:

Le 18/10/2014 17:38, Roelof Wobben [email protected]
[ocaml_beginners] a

écrit :

> Almost but without the () and your script gives a
error message.

A good exercise would be:

- to correct it

- and to explain what it is supposed to do?

If you want help, please ask more precise questions. The
benefit of it

will be that most of the time, you'll find the answer
yourself while

writing the question.

Before your write your functions, try to write it's type:
it will help a

lot.

Hoping this will help

--

Matthieu Dubuget

Guide d’autodéfense numérique : http://guide.boum.org

oke,

After some trail and error this seems to work :

let rec last list =

match list with

| [] -> None

| [x] -> None

| [x;y]-> Some (x,y)

| hd :: tl -> last tl

;;

I think it not possible to make a output like x y without the ()

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
(13)

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=X3oDMTJkOWtkdnNsBF9TAzk3NDc2NTkwBGdycElkAzQ5OTkxOTQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxNDEzNjQ5NzEx

• 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.