caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Florent Ouchet <florent.ouchet@imag.fr>
To: Su Zhang <westlifezs@gmail.com>, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] a question bout exetract a sub-element of element in	triple
Date: Mon, 23 Feb 2009 10:39:43 +0100	[thread overview]
Message-ID: <49A26EDF.9050403@imag.fr> (raw)
In-Reply-To: <e2842950902221356o35c3fd3s8d0dbbc0a4152e16@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 910 bytes --]

Su Zhang a écrit :
> I encountered a new problem which is I want to get " 1 " from a triple 
> "(0,2,[1,2,3])", which means I want to get the first value of the 
> third item in one triple and itself is a list, but when I use the 
> List.hd (third(0,2,[1,2,3])), it will give me the entire list which is 
> [1,2,3]
> the definition of the third is "let third(x,y,z)=z", so is there a way 
> I can get out "1" from "(0,2,[1,2,3])"? if possible, would you please 
> give me some advices?
Hi,

[1,2,3] is equivalent to [(1,2,3)], which means "a list containing one 
element whose type is (int*int*int)".
first (List.hd (third(0,2,[1,2,3]))) = 1

[1;2;3] denotes a list of three integer elements.
List.hd (third(0,2,[1;2;3])) = 1

As said in a reply to your previous message, you'll get more complete 
answers by posting to this more suited group: 
http://groups.yahoo.com/group/ocaml_beginners

Cheers,

Florent


[-- Attachment #2: florent.ouchet.vcf --]
[-- Type: text/x-vcard, Size: 309 bytes --]

begin:vcard
fn:Florent Ouchet
n:Ouchet;Florent
org:;CIS/VDS
adr;quoted-printable:46, avenue F=C3=A9lix Viallet,;;TIMA Laboratory - T131;GRENOBLE Cedex;;38031;France
email;internet:florent.ouchet@imag.fr
title:PhD student
tel;work:0476574872
x-mozilla-html:FALSE
url:http://tima.imag.fr
version:2.1
end:vcard


      parent reply	other threads:[~2009-02-23  9:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-22 21:56 Su Zhang
2009-02-22 22:04 ` [Caml-list] " Christophe Raffalli
2009-02-23  9:39 ` Florent Ouchet [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49A26EDF.9050403@imag.fr \
    --to=florent.ouchet@imag.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=westlifezs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).