Mercurial > repos > tabletprog
annotate modules/option.tp @ 359:023c29e1f595
Remove extraneous and from x86 module
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 17 Apr 2015 17:52:22 -0700 |
parents | fd4e0bf5bd9f |
children |
rev | line source |
---|---|
275
d83647152485
Added option module which was omitted in commit of SDL work
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 { |
d83647152485
Added option module which was omitted in commit of SDL work
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 _none <- #{ |
d83647152485
Added option module which was omitted in commit of SDL work
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 value:none <- :ifval :ifnone { |
d83647152485
Added option module which was omitted in commit of SDL work
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 ifnone: |
d83647152485
Added option module which was omitted in commit of SDL work
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
5 } |
338
1458c069c715
Added "value" method to option value and option none. It behaves similarly to value:none, except the none case just propagates the none value and the value case wraps the result in an option value
Michael Pavone <pavone@retrodev.com>
parents:
290
diff
changeset
|
6 value <- :ifval { self } |
290
38ca63e0a62e
Added value? and none? methods to option value and option none
Michael Pavone <pavone@retrodev.com>
parents:
275
diff
changeset
|
7 value? <- { false } |
38ca63e0a62e
Added value? and none? methods to option value and option none
Michael Pavone <pavone@retrodev.com>
parents:
275
diff
changeset
|
8 none? <- { true } |
275
d83647152485
Added option module which was omitted in commit of SDL work
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
9 } |
d83647152485
Added option module which was omitted in commit of SDL work
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
10 #{ |
d83647152485
Added option module which was omitted in commit of SDL work
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
11 value <- :v { |
d83647152485
Added option module which was omitted in commit of SDL work
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
12 #{ |
d83647152485
Added option module which was omitted in commit of SDL work
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
13 value:none <- :ifval :ifnone { |
d83647152485
Added option module which was omitted in commit of SDL work
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
14 ifval: v |
d83647152485
Added option module which was omitted in commit of SDL work
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
15 } |
338
1458c069c715
Added "value" method to option value and option none. It behaves similarly to value:none, except the none case just propagates the none value and the value case wraps the result in an option value
Michael Pavone <pavone@retrodev.com>
parents:
290
diff
changeset
|
16 value <- :ifval { |
346
fd4e0bf5bd9f
Fix value method on option value
Michael Pavone <pavone@retrodev.com>
parents:
338
diff
changeset
|
17 option value: (ifval: v) |
338
1458c069c715
Added "value" method to option value and option none. It behaves similarly to value:none, except the none case just propagates the none value and the value case wraps the result in an option value
Michael Pavone <pavone@retrodev.com>
parents:
290
diff
changeset
|
18 } |
290
38ca63e0a62e
Added value? and none? methods to option value and option none
Michael Pavone <pavone@retrodev.com>
parents:
275
diff
changeset
|
19 value? <- { true } |
38ca63e0a62e
Added value? and none? methods to option value and option none
Michael Pavone <pavone@retrodev.com>
parents:
275
diff
changeset
|
20 none? <- { false } |
275
d83647152485
Added option module which was omitted in commit of SDL work
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
21 } |
d83647152485
Added option module which was omitted in commit of SDL work
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
22 } |
d83647152485
Added option module which was omitted in commit of SDL work
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
23 none <- { _none } |
d83647152485
Added option module which was omitted in commit of SDL work
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
24 } |
290
38ca63e0a62e
Added value? and none? methods to option value and option none
Michael Pavone <pavone@retrodev.com>
parents:
275
diff
changeset
|
25 } |