| 1 |
(******************************************************************************* |
|---|
| 2 |
Copyright 2008 Sun Microsystems, Inc., |
|---|
| 3 |
4150 Network Circle, Santa Clara, California 95054, U.S.A. |
|---|
| 4 |
All rights reserved. |
|---|
| 5 |
|
|---|
| 6 |
U.S. Government Rights - Commercial software. |
|---|
| 7 |
Government users are subject to the Sun Microsystems, Inc. standard |
|---|
| 8 |
license agreement and applicable provisions of the FAR and its supplements. |
|---|
| 9 |
|
|---|
| 10 |
Use is subject to license terms. |
|---|
| 11 |
|
|---|
| 12 |
This distribution may include materials developed by third parties. |
|---|
| 13 |
|
|---|
| 14 |
Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered |
|---|
| 15 |
trademarks of Sun Microsystems, Inc. in the U.S. and other countries. |
|---|
| 16 |
******************************************************************************) |
|---|
| 17 |
|
|---|
| 18 |
component booleanGuard |
|---|
| 19 |
import List.{...} |
|---|
| 20 |
export Executable |
|---|
| 21 |
|
|---|
| 22 |
run(args:String...):() = do |
|---|
| 23 |
a = <|0+0,1,2,3,5,6,7|> |
|---|
| 24 |
c = <| x | x <- a, true |> |
|---|
| 25 |
assert(c,a," true") |
|---|
| 26 |
b = <| x | x <- a, x>2 |> |
|---|
| 27 |
assert(b,a.filter(fn (x)=>x>2)," x>2") |
|---|
| 28 |
d = <| x | x <- a, false |> |
|---|
| 29 |
assert(d.isEmpty(), "not isEmpty false") |
|---|
| 30 |
e = <| 17 | _ <- true |> |
|---|
| 31 |
assert(e,<|17|>,"true =/= <|17|>") |
|---|
| 32 |
q = <| q | q <- Just[\(ZZ32,ZZ32)\](17,3) |> |
|---|
| 33 |
assert(q,<|(17,3),(17,3)|>.drop(1), " Just") |
|---|
| 34 |
f = <| x | x <- true |> |
|---|
| 35 |
assert(f,<|(),()|>.drop(1), " void") |
|---|
| 36 |
end |
|---|
| 37 |
|
|---|
| 38 |
end |
|---|