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

Annotation of /metaprl/library/nuprl5.ml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2443 - (hide annotations) (download)
Mon Aug 24 13:43:48 1998 UTC (22 years, 11 months ago) by jyh
File size: 2166 byte(s)
Slightly better Ensemble scheduling.
Native-code compiler has trouble marshaling functions--
its probably a problem with the marshaler.

Added Nl_num, a ML-only implementation of bignums.
This is slower than the C version used by OCaml, but
we can marshal the Nl_nums.  Most of the files changed
are just replacements of Num.* with Nl_num.*.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26