annotate samples/logical.tp @ 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
author Michael Pavone <pavone@retrodev.com>
date Sat, 04 Apr 2015 11:54:46 -0700
parents 59a94f3ad56f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
97
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #{
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
2
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
3 foo <- {
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
4 print: "foo\n"
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
5 true
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
6 }
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
7
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
8 bar <- {
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
9 print: "bar\n"
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
10 false
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
11 }
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
12
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
13 baz <- {
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
14 print: "baz\n"
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
15 true
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
16 }
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
17
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
18 qux <- {
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
19 print: "shouldn't be printed\n"
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
20 true
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
21 }
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
22
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
23
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
24 main <- {
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
25 foo && bar || (baz || qux)
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
26 }
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
27
59a94f3ad56f Added short-circuit && and || operators
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
28 }