[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Alain Frisch <alain@f...> |
| Subject: | Re: [Caml-list] Circuralizing lists |
Till Varoquaux wrote: > 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? No, this is not possible (using only safe features). The only recursive (non functional) value loops that can be built have a fixed shape. -- Alain