Sorry about the confusion. I'm taking from one element from each list per record. The lists can all be arbitrarily long as long as they share the same length.  

lista = [1; 2; 3; 4; 5; 6; 3]
listb = [2; 5; 7; 8; 1; 2; 4]
listc = [4; 6; 8; 3; 5; 8; 2]

type t = {a : int; b: int; c: int}

{a=1; b=2; c=4}
{a=2; b=5; c=6}
{a=3; b=7; c=8}
{a=4; b=8; c=3}
...

I will subscribe to the beginners list as well.

Thanks,
Casey


On Thu, Sep 5, 2013 at 9:46 AM, John Whitington <john@coherentgraphics.co.uk> wrote:
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/




--
Casey James Basichis
Composer - Adventure Time - Cartoon Network
http://www.caseyjamesbasichis.com
caseybasichis@gmail.com
310.387.7540