~ubuntu-branches/ubuntu/karmic/ocaml-doc/karmic

« back to all changes in this revision

Viewing changes to ocaml.html/manual046.html

  • Committer: Bazaar Package Importer
  • Author(s): Vanicat Rémi
  • Date: 2002-02-05 10:51:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020205105143-a061tunf8tev07ne
Tags: 3.04-4
* New debian maintainer
* Split doc-base file
* Move to non-free
* Change the copyright file to the copyright of the documentation
* remove FAQs (their license prohibit their redistribution)
* corrected the examples

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
 
2
            "http://www.w3.org/TR/REC-html40/loose.dtd">
 
3
<HTML>
 
4
<HEAD>
 
5
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
 
6
<META name="GENERATOR" content="hevea 1.05">
 
7
<TITLE>
 
8
 Module Lazy: deferred computations.
 
9
</TITLE>
 
10
</HEAD>
 
11
<BODY TEXT=black BGCOLOR=white>
 
12
<A HREF="manual045.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
 
13
<A HREF="manual032.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
 
14
<A HREF="manual047.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
 
15
<HR>
 
16
<TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%">
 
17
<TR><TD BGCOLOR="#66ff66"><DIV ALIGN=center><TABLE>
 
18
<TR><TD><B><FONT SIZE=5>19.14</FONT></B></TD>
 
19
<TD WIDTH="100%" ALIGN=center><B><FONT SIZE=5> Module </FONT></B><B><FONT SIZE=5><TT>Lazy</TT></FONT></B><B><FONT SIZE=5>: deferred computations.</FONT></B></TD>
 
20
</TR></TABLE></DIV></TD>
 
21
</TR></TABLE><BR>
 
22
<A NAME="s:Lazy"></A>
 
23
<A NAME="@manual416"></A><BR>
 
24
<PRE>
 
25
type 'a status =
 
26
  | Delayed of (unit -&gt; 'a)
 
27
  | Value of 'a
 
28
  | Exception of exn
 
29
;;
 
30
type 'a t = 'a status ref;;
 
31
</PRE><BLOCKQUOTE>
 
32
A value of type <CODE>'a Lazy.t</CODE> is a deferred computation (also called a
 
33
suspension) that computes a result of type <CODE>'a</CODE>. The expression
 
34
<CODE>lazy (expr)</CODE> returns a suspension that computes <CODE>expr</CODE>.</BLOCKQUOTE>
 
35
<PRE>
 
36
exception Undefined;;
 
37
val force: 'a t -&gt; 'a;;
 
38
</PRE><A NAME="@manual417"></A><A NAME="@manual418"></A><BLOCKQUOTE>
 
39
<CODE>Lazy.force x</CODE> computes the suspension <CODE>x</CODE> and returns its result.
 
40
If the suspension was already computed, <CODE>Lazy.force x</CODE> returns the
 
41
same value again. If it raised an exception, the same exception is
 
42
raised again.
 
43
Raise <CODE>Undefined</CODE> if the evaluation of the suspension requires its
 
44
own result.</BLOCKQUOTE>
 
45
 
 
46
<HR>
 
47
<A HREF="manual045.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
 
48
<A HREF="manual032.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
 
49
<A HREF="manual047.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
 
50
</BODY>
 
51
</HTML>