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

Diff of /metaprl/library/nuprl5.ml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2149 by eaton, Wed Apr 22 18:25:10 1998 UTC revision 2184 by jyh, Wed May 27 15:15:13 1998 UTC
# Line 1  Line 1 
1  open Term  open Refiner.Refiner.Term
2  open Opname  open Opname
3  open Num  open Num
4    
# Line 7  Line 7 
7  (* parameter mapping *)  (* parameter mapping *)
8    
9  let make_bool_parameter b =  let make_bool_parameter b =
10    make_param (ParmList    make_param (ParamList
11                  [(make_param (Token "bool")); (make_param (Number (Num.Int (if b then 1 else 0))))])                  [(make_param (Token "bool")); (make_param (Number (Num.Int (if b then 1 else 0))))])
12    
13  let make_time_parameter time =  let make_time_parameter time =
14    make_param (ParmList    make_param (ParamList
15                  [(make_param (Token "time")); (make_param (Number time))])                  [(make_param (Token "time")); (make_param (Number time))])
16    
17  let time_parameter_p p =  let time_parameter_p p =
18    match (dest_param p) with    match (dest_param p) with
19      ParmList [h; a; b] -> (match (dest_param h) with      ParamList [h; a; b] -> (match (dest_param h) with
20        Token s -> if s = "time" then (match (dest_param a) with        Token s -> if s = "time" then (match (dest_param a) with
21          Number i -> (match (dest_param b) with          Number i -> (match (dest_param b) with
22            Number i -> true            Number i -> true
# Line 27  Line 27 
27    
28  let bool_parameter_p p =  let bool_parameter_p p =
29    match (dest_param p) with    match (dest_param p) with
30      ParmList [h; v] -> (match (dest_param h) with      ParamList [h; v] -> (match (dest_param h) with
31        Token s -> if s = "bool" then (match (dest_param v) with        Token s -> if s = "bool" then (match (dest_param v) with
32          Number (Num.Int i) -> (i = 1) or (i = 0)          Number (Num.Int i) -> (i = 1) or (i = 0)
33        | _ -> false) else false        | _ -> false) else false
# Line 36  Line 36 
36    
37  let destruct_time_parameter p =  let destruct_time_parameter p =
38    match (dest_param p) with    match (dest_param p) with
39      ParmList [h; n] -> (match (dest_param h) with      ParamList [h; n] -> (match (dest_param h) with
40        Token s -> (if s = "time" then (match (dest_param n) with        Token s -> (if s = "time" then (match (dest_param n) with
41          Number i -> i          Number i -> i
42        | _ -> raise (Invalid_argument "destruct_time_parameter_b"))        | _ -> raise (Invalid_argument "destruct_time_parameter_b"))
# Line 47  Line 47 
47    
48  let destruct_bool_parameter p =  let destruct_bool_parameter p =
49    match (dest_param p) with    match (dest_param p) with
50      ParmList [h; v] -> (match (dest_param h) with      ParamList [h; v] -> (match (dest_param h) with
51        Token s -> if s = "bool" then (match (dest_param v) with        Token s -> if s = "bool" then (match (dest_param v) with
52          Number (Num.Int i) -> i = 1          Number (Num.Int i) -> i = 1
53        | _ -> raise (Invalid_argument "destruct_bool_parameter"))        | _ -> raise (Invalid_argument "destruct_bool_parameter"))

Legend:
Removed from v.2149  
changed lines
  Added in v.2184

  ViewVC Help
Powered by ViewVC 1.1.26