caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Circuralizing lists
@ 2007-11-26 21:46 Till Varoquaux
  2007-11-26 21:58 ` [Caml-list] " Alain Frisch
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Till Varoquaux @ 2007-11-26 21:46 UTC (permalink / raw)
  To: Caml List

Writing the list containing an inifinite number of ones can easily be done as:

let rec ones = 1::ones

I however don't know of any type safe to generate the infinite list
which is the repetition of a given list (in a type safe non lazy way).
What I'm looking for is a code that would do:

let circularize  = function
    | [] -> failwith "cannot circularize empty lists"
    | l -> let rec res = l@res in res

Is this at all possible?

Cheers,
Till


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-12-20 21:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-26 21:46 Circuralizing lists Till Varoquaux
2007-11-26 21:58 ` [Caml-list] " Alain Frisch
2007-11-26 22:41 ` Jon Harrop
2007-12-20 21:04 ` David Thomas

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).