Re: last item. no output

"Christopher Zimmermann [email protected] [ocaml_beginners]" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

I guess you want to do something like this:

let f = function
  | a :: b :: c :: tl -> (a,b,c)
  | invalid_arg "list too short"

f [1;2;3;4;5;6]

Christopher

On October 18, 2014 5:07:15 PM CEST, "Roelof Wobben [email protected] [ocaml_beginners]" <[email protected]> wrote:
>Amir Chaudhry [email protected] [ocaml_beginners] schreef op 18-10-2014
>14:43:
>> On 18 Oct 2014, at 12:46, "Roelof Wobben [email protected]
>[ocaml_beginners]" <[email protected]> wrote:
>>
>>> I forget to tell that I work now in utop and not from a saved file.
>> I may have misunderstood what you meant, and you might already know
>this, but you can still use a saved file and run it in utop. If you
>keep your code in a file called my_file.ml, you can run the following
>command in utop.
>>
>> #use "my_file.ml";;
>>
>> (In the file itself you do not need to use double semi-colons)
>>
>> More info from the Manual [1]:
>> #use "file-name";;
>> Read, compile and execute source phrases from the given file. This is
>textual inclusion: phrases are processed just as if they were typed on
>standard input. The reading of the file stops at the first error
>encountered.
>>
>> [1]
>http://caml.inria.fr/pub/docs/manual-ocaml-4.02-1/toplevel.html#sec256
>>
>>
>
>Thanks everyone.
>
>Let's say I want to have to last three items of a list can I do
>something like this :
>
>[x:y:z] -> some x y z
>
>Or must I split this one is three seperate rules ?
>
>Roelof
>
>
>
>------------------------------------
>
>------------------------------------
>
>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.
>------------------------------------
>
>Yahoo Groups Links
>
>
>

- --
http://gmerlin.de
OpenPGP: http://gmerlin.de/christopher.pub
F190 D013 8F01 AA53 E080  3F3C F17F B0A1 D44E 4FEE
-----BEGIN PGP SIGNATURE-----
Version: APG v1.1.1

iQJNBAEBCgA3BQJUQoV2MBxDaHJpc3RvcGhlciBaaW1tZXJtYW5uIDxjaHJpc3Rv
cGhlckBnbWVybGluLmRlPgAKCRDxf7Ch1E5P7lgFD/9JyCtnPplVK/9h4DPs3IpO
eoIZSRD4TWO5twWgQcN54gFMM69mrrc/ruu5p5ZjQD5YsSgsNXqL+MefP+yhnfO0
KmdSYfN/INNWHuliVxPelWhDtRX0VchSMSdI7NSXZL3A0zxJ7UkPfldLgmwcY+X3
QdtXxOCEezUZ1EyzQdQS7lALkrgbq2V7Ifmwn2WvRAmEy57weVVNmXMt4m2yeKJA
O1r8koEMNFOechnT/g2e9v4KLss1SyG46+T/7CkMh0XSuZRsco9isKNaS+/KyWKQ
iYgJrQKoH6CQQOYuHLBktBvrV0wVMxvplsMNlk1JqvdlNCWl4G3pJB5wTQvqMIw8
zqpnkMQdwJZA05oiyREjve/JiYbQUYdPEBpMltr4IjhSH62oqbuhjVOlg7br9M7u
gozijsjcQ71UEQ3iU6EtCu8iD/qtIrmJ+D+juz6IZZHbB5h2jrP1Vxtm1PqEoboQ
H9wcYfWuFyLkwFFhxowLL5c3Hs9M+3+zfNw2i6FklmotWG+M8cgjKGOHFyA06+vM
8XYMcyrSOXpQlb9fWlwDyHDwA0r/ryx7PWDyoTk7CdBUH1TdkXcVuWgpBjdon2eb
FjlC7M7/RAzClGeP8tjoBxYtnWXC6jREItLdw1guEoNdwkA9jYxv9uhkegP4S5UX
4x0jPP5om5b2KpyFILbx8w==
=sjRm
-----END PGP SIGNATURE-----
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.