1(*
2    The environment file to expand the examples.
3
4    It is in ``Caml'' style and uses simple Caml-like bindings.
5
6    For variables, we use:
7
8    let name = value;;
9
10    For functions, we use:
11
12    let f x =
13      "$x"
14    ;;
15
16*)
17
18(* A function definition. *)
19let f x = "My argument was $(x)";;
20
21let t = "named t";;
22
23(* A function application. *)
24let y = "$(f t)";;
25
26let concat x y = "$(x)$(y)";;
27
28let z = $t;;
29
30let u = $(concat "con" "catenation");;
31
32let title t =
33"<!--#include virtual=\"doctype\" -->
34<HTML>
35
36<HEAD>
37<META name=\"GENERATOR\" content=\"Htmlc $htmlc_version\">
38<META http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">
39
40<TITLE>
41$t
42</TITLE>
43</HEAD>
44
45<BODY BGCOLOR=\"#FFFFFF\">
46
47<!--#include virtual=\"topofpage-eng.html\"-->
48";;
49
50let expand s = "$(scan_lines $s)";;
51
52let blank n = $(string_make " " n);;
53
54let forty_two = 42;;
55
56let glop_glop = "glop glop";;
57let pasglop_pasglop = "pas glop pas glop";;
58let pifou_content b = "$(conditional b glop_glop pasglop_pasglop)";;
59
60let a_href url options text = "<a href=\"$(url)\" $(options)>$(text)</a>";;
61let link url text = "$(a_href $(url) \"\" $(text))";;
62let safe_link url text =
63  "$(conditional $(is_empty url) text $(link url text))"
64;;
65
66let empty_url = "";;
67let nonempty_url = "url";;
68