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

Annotation of /metaprl/library/nuprl5.ml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2105 - (hide annotations) (download)
Tue Apr 7 18:08:03 1998 UTC (23 years, 3 months ago) by lolorigo
File size: 2218 byte(s)
mathbus, num, int32

1 lolorigo 2041 open Term
2     open Opname
3 lolorigo 2105 open Int32
4 lolorigo 2041
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 eli 2099 [(make_param (Token "bool")); (make_param (Number (Num.Int (if b then 1 else 0))))])
13 lolorigo 2041 let make_time_parameter time =
14 lolorigo 2105 let (a, b) = dest_int32 time in
15 lolorigo 2041 make_param (ParmList
16 eli 2099 [(make_param (Token "time")); (make_param (Number (Num.Int a))); (make_param (Number (Num.Int b)))])
17 lolorigo 2041
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 eli 2099 Number (Num.Int i) -> (i = 1) or (i = 0)
34 lolorigo 2041 | _ -> 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 eli 2099 Number (Num.Int i) -> (match (dest_param b) with
43 lolorigo 2105 Number (Num.Int k) -> make_int32 (i, k)
44 lolorigo 2041 | _ -> 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 eli 2099 Number (Num.Int i) -> i = 1
55 lolorigo 2041 | _ -> 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