From: Matt Gushee <mgushee@havenrock.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Snd question
Date: Mon, 15 Aug 2005 16:41:20 -0600	[thread overview]
Message-ID: <43011A10.4090108@havenrock.com> (raw)
In-Reply-To: <161F0D30A699A84A8B7435B62BCE33B30360E19F@APS-MSG-01.southpacific.corp.microsoft.com>
Anu Engineer wrote:
 > Please forgive me if my question is very naïve, I am very new to 
Ocaml. I was
 > wondering why snd returns an  error when I use it with more than 2 
elements, why
 > not return the rest of the list when I apply to something larger than 
a pair ?
Your question shows your misunderstanding: snd operates on tuples, not 
lists. If it did operate on lists the length wouldn't matter, because 
length doesn't affect the type of a list. I.e.
     [ 1; 2; 3; ... n ]
is of type 'int list' whether it has 4 elements or 40,000,000. Whereas 
tuples have the same type if and only if they have the same number of 
members, and all members have the same types. E.g:
     VALUE        TYPE
     (1, 2)         int * int
     (1, 2, 4)        int * int * int
     (57, false)            int * bool
     ('x', "buzz")       char * string
There is no such thing as a tuple with an arbitrary number of members, 
thus no function that can operate on one.
I hope that clarifies things a bit. By the way, this sort of question is 
probably best asked on the beginner's list (you'll see the address at 
the bottom of this message).
-- 
Matt Gushee
Englewood, CO, USA
next prev parent reply	other threads:[~2005-08-15 22:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-15 22:05 Anu Engineer
2005-08-15 22:41 ` Matt Gushee [this message]
2005-08-16  8:08   ` [Caml-list] " sejourne kevin
2005-08-16 13:17   ` skaller
2005-08-16 16:16     ` Julian Brown
2005-08-16 17:18       ` [Caml-list] " Alan Falloon
2005-08-17  6:15       ` skaller
2005-08-16 16:34     ` [Caml-list] " Jon Harrop
2005-08-16 18:16       ` Richard Jones
2005-08-16 21:42         ` Jon Harrop
2005-08-17  6:55           ` skaller
2005-08-18  8:20             ` Andrej Bauer
2005-08-18 17:51               ` skaller
2005-08-19  7:50                 ` Andrej Bauer
2005-08-17 12:19         ` Alain Frisch
2005-08-17 17:21           ` skaller
2005-08-17 23:08           ` Martin Jambon
2005-08-17  6:28       ` skaller
2005-08-20 14:31     ` Brian Hurt
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=43011A10.4090108@havenrock.com \
    --to=mgushee@havenrock.com \
    --cc=caml-list@inria.fr \
    /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