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

Annotation of /metaprl/library/nuprl5.ml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2184 - (hide annotations) (download)
Wed May 27 15:15:13 1998 UTC (23 years, 2 months ago) by jyh
File size: 2026 byte(s)
Functorized the refiner over the Term module.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26