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

Contents of /metaprl/library/nuprl5.ml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2443 - (show 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 open Printf
2 open Nl_debug
3
4 open Refiner.Refiner.Term
5 open Refiner.Refiner.TermType
6 open Opname
7 open Nl_num
8
9 let _ =
10 if !debug_load then
11 eprintf "Loading Nuprl5%t" eflush
12
13 let nuprl5_opname = mk_opname "!nuprl5_implementation!" nil_opname
14
15 (* parameter mapping *)
16
17 let make_bool_parameter b =
18 make_param (ParamList
19 [(make_param (Token "bool")); (make_param (Number (Nl_num.Int (if b then 1 else 0))))])
20
21 let make_time_parameter time =
22 make_param (ParamList
23 [(make_param (Token "time")); (make_param (Number time))])
24
25 let time_parameter_p p =
26 match (dest_param p) with
27 ParamList [h; a; b] -> (match (dest_param h) with
28 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 ParamList [h; v] -> (match (dest_param h) with
39 Token s -> if s = "bool" then (match (dest_param v) with
40 Number (Nl_num.Int i) -> (i = 1) or (i = 0)
41 | _ -> false) else false
42 | _ -> false)
43 | _ -> false
44
45 let destruct_time_parameter p =
46 match (dest_param p) with
47 ParamList [h; n] -> (match (dest_param h) with
48 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
55
56 let destruct_bool_parameter p =
57 match (dest_param p) with
58 ParamList [h; v] -> (match (dest_param h) with
59 Token s -> if s = "bool" then (match (dest_param v) with
60 Number (Nl_num.Int i) -> i = 1
61 | _ -> 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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26