From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 4414E820A2 for ; Thu, 5 Sep 2013 18:47:05 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of john@coherentgraphics.co.uk) identity=pra; client-ip=188.64.184.40; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="john@coherentgraphics.co.uk"; x-sender="john@coherentgraphics.co.uk"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of john@coherentgraphics.co.uk) identity=mailfrom; client-ip=188.64.184.40; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="john@coherentgraphics.co.uk"; x-sender="john@coherentgraphics.co.uk"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@bluechip4.ukhost4u.com) identity=helo; client-ip=188.64.184.40; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="john@coherentgraphics.co.uk"; x-sender="postmaster@bluechip4.ukhost4u.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgoCAFK1KFK8QLgoemdsb2JhbABbgzyvVpJFgSsWDgEBCwcNCTyCJAEBBAEnEUABBQsLBxEJEwMPCQMCAQIBMxIGDheHXgMJCgixOgOIeo9gB4QdA5kkk1g X-IPAS-Result: AgoCAFK1KFK8QLgoemdsb2JhbABbgzyvVpJFgSsWDgEBCwcNCTyCJAEBBAEnEUABBQsLBxEJEwMPCQMCAQIBMxIGDheHXgMJCgixOgOIeo9gB4QdA5kkk1g X-IronPort-AV: E=Sophos;i="4.90,848,1371074400"; d="scan'208";a="31673178" Received: from bluechip4.ukhost4u.com ([188.64.184.40]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 05 Sep 2013 18:47:04 +0200 Received: from 78-105-203-81.zone3.bethere.co.uk ([78.105.203.81]:64045 helo=feast.local) by bluechip4.ukhost4u.com with esmtpa (Exim 4.80.1) (envelope-from ) id 1VHchu-004Bi9-Ec; Thu, 05 Sep 2013 17:46:58 +0100 Message-ID: <5228B581.3010903@coherentgraphics.co.uk> Date: Thu, 05 Sep 2013 17:46:57 +0100 From: John Whitington User-Agent: Postbox 3.0.8 (Macintosh/20130427) MIME-Version: 1.0 To: Casey Basichis CC: OCaml Mailing List References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bluechip4.ukhost4u.com X-AntiAbuse: Original Domain - inria.fr X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - coherentgraphics.co.uk X-Get-Message-Sender-Via: bluechip4.ukhost4u.com: authenticated_id: john@coherentgraphics.co.uk Subject: Re: [Caml-list] Construct a list of records from several lists Hi Casey, Casey Basichis wrote: > Hi, > > I'm new to Ocaml. There is also this list, for beginners specifically: http://groups.yahoo.com/neo/groups/ocaml_beginners/info > I have five lists of ints, how can I can I combine them into a list of > records where the fields are filled with values from each of the lists? Do you mean that the lists are fixed-length, that you have a record type something like type t = {a : int; b : int; c : int; d : int} and you want to convert each list, which is something like [1; 2; 3; 4] into a record something like {a = 1; b = 2; c = 3; d = 4} ? In which case, you want to use pattern matching to write a function of type int list -> t which converts a (fixed-length) list to a thing of type t and then you can use List.map to deal with all your lists, producing a t list from an int list list. If you meant something different entirely, please clarify! With Thanks, -- John Whitington Director, Coherent Graphics Ltd http://www.coherentpdf.com/