summaryrefslogtreecommitdiff
path: root/src/runtime/ovalue.r
blob: e428868e812c26161cd2657680718e7ea7eaf28e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
 * File: ovalue.r
 *  Contents: nonnull, null, value, conj
 */

"\\x - test x for nonnull value."

operator{0,1} \ nonnull(underef x -> dx)
   abstract {
      return type(x)
      }
   /*
    * If the dereferenced value dx is not null, the pre-dereferenced
    *  x is returned, otherwise, the function fails.
    */
   if is:null(dx) then
      inline {
         fail;
         }
   else {
      inline {
         return x;
         }
      }
end



"/x - test x for null value."

operator{0,1} / null(underef x -> dx)
   abstract {
      return type(x)
      }
   /*
    * If the dereferenced value dx is null, the pre-derefereneced value
    *  x is returned, otherwise, the function fails.
    */
   if is:null(dx) then {
      inline {
         return x;
         }
      }
   else
      inline {
         fail;
      }
end


".x - produce value of x."

operator{1} . value(x)
  abstract {
     return type(x)
     }
  inline {
     return x;
     }
end


"x & y - produce value of y."

operator{1} & conj(underef x, underef y)
   abstract {
      return type(y)
      }
   inline {
      return y;
      }
end