/[mojave]/metaprl/library/nuprl5.ml
ViewVC logotype

Contents of /metaprl/library/nuprl5.ml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2099 - (show annotations) (download)
Fri Mar 20 22:16:22 1998 UTC (23 years, 4 months ago) by eli
File size: 2221 byte(s)
Eli: Changed integer parameters to Num.num's.

1 open Term
2 open Opname
3 open BigInt
4
5
6 let nuprl5_opname = mk_opname "!nuprl5_implementation!" nil_opname
7
8 (* parameter mapping *)
9
10 let make_bool_parameter b =
11 make_param (ParmList
12 [(make_param (Token "bool")); (make_param (Number (Num.Int (if b then 1 else 0))))])
13 let make_time_parameter time =
14 let (a, b) = dest_bigint time in
15 make_param (ParmList
16 [(make_param (Token "time")); (make_param (Number (Num.Int a))); (make_param (Number (Num.Int b)))])
17
18 let time_parameter_p p =
19 match (dest_param p) with
20 ParmList [h; a; b] -> (match (dest_param h) with
21 Token s -> if s = "time" then (match (dest_param a) with
22 Number i -> (match (dest_param b) with
23 Number i -> true
24 | _ -> false)
25 | _ -> false) else false
26 | _ -> false)
27 | _ -> false
28
29 let bool_parameter_p p =
30 match (dest_param p) with
31 ParmList [h; v] -> (match (dest_param h) with
32 Token s -> if s = "bool" then (match (dest_param v) with
33 Number (Num.Int i) -> (i = 1) or (i = 0)
34 | _ -> false) else false
35 | _ -> false)
36 | _ -> false
37
38 let destruct_time_parameter p =
39 match (dest_param p) with
40 ParmList [h; a; b] -> (match (dest_param h) with
41 Token s -> if s = "time" then (match (dest_param a) with
42 Number (Num.Int i) -> (match (dest_param b) with
43 Number (Num.Int k) -> make_bigint (i, k)
44 | _ -> raise (Invalid_argument "destruct_time_parameter"))
45 | _ -> raise (Invalid_argument "destruct_time_parameter"))
46 else raise (Invalid_argument "destruct_time_parameter")
47 | _ -> raise (Invalid_argument "destruct_time_parameter"))
48 | _ -> raise (Invalid_argument "destruct_time_parameter")
49
50 let destruct_bool_parameter p =
51 match (dest_param p) with
52 ParmList [h; v] -> (match (dest_param h) with
53 Token s -> if s = "bool" then (match (dest_param v) with
54 Number (Num.Int i) -> i = 1
55 | _ -> raise (Invalid_argument "destruct_bool_parameter"))
56 else raise (Invalid_argument "destruct_bool_parameter")
57 | _ -> raise (Invalid_argument "destruct_bool_parameter"))
58 | _ -> raise (Invalid_argument "destruct_bool_parameter")
59
60 (* common terms *)
61
62 (*
63 let itoken_term s = mk_token_term nuprl5_opname s
64 let inatural_term i = mk_number_term nuprl5_opname i
65 *)
66
67
68

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26