caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alain Frisch <alain@frisch.fr>
To: Till Varoquaux <till.varoquaux@gmail.com>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Circuralizing lists
Date: Mon, 26 Nov 2007 22:58:31 +0100	[thread overview]
Message-ID: <474B4187.8040301@frisch.fr> (raw)
In-Reply-To: <9d3ec8300711261346r4b74f5gddce229324dcad2c@mail.gmail.com>

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


  reply	other threads:[~2007-11-26 22:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-26 21:46 Till Varoquaux
2007-11-26 21:58 ` Alain Frisch [this message]
2007-11-26 22:41 ` [Caml-list] " Jon Harrop
2007-12-20 21:04 ` David Thomas

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=474B4187.8040301@frisch.fr \
    --to=alain@frisch.fr \
    --cc=caml-list@inria.fr \
    --cc=till.varoquaux@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).