caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Stephen Brackin" <stephen.brackin@verizon.net>
To: <caml-list@yquem.inria.fr>
Subject: Ask-if-continue wrapper?
Date: Wed, 28 Dec 2005 03:44:29 -0500	[thread overview]
Message-ID: <0IS700AHX9M9TKT2@vms042.mailsrvcs.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 1079 bytes --]

I'd like an OCaml function, which I'll call continueq, with the property
that for any function f with argument(s) fargs,

continueq f fargs tsecs defaultval

starts evaluating f on fargs and lets this evaluation proceed for up to
tsecs seconds. If the computation of (f fargs) completes in this time, then
it returns the result of that computation. Otherwise, it asks the user how
many seconds to let the computation of (f fargs) proceed. If the user inputs
a value less than or equal to 0, then it returns defaultval. If the user
inputs a value tsecs' greater than 0, then it evaluates

continueq f' fargs' tsecs' defaultval

where (f' fargs') denotes the computation state of (f fargs) at the time it
was interrupted.

I want to give the user the option of continuing without having to repeat
earlier calculations. This is similar to the checkpoint utility ckpt, and
similar to the "timeout" function described in the O'Reilly "'Developing
Applications with Objective Caml" reference book, but not quite the same as
either. Will someone please tell me how to do it?

Steve

 


[-- Attachment #2: Type: text/html, Size: 3741 bytes --]

             reply	other threads:[~2005-12-28  8:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-28  8:44 Stephen Brackin [this message]
2005-12-28  9:36 ` [Caml-list] " Jonathan Roewen
2005-12-28  9:53 ` Florian Weimer
2005-12-28 18:34 ` Xavier Leroy

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=0IS700AHX9M9TKT2@vms042.mailsrvcs.net \
    --to=stephen.brackin@verizon.net \
    --cc=caml-list@yquem.inria.fr \
    /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).