Skip to content

Commit ab57726

Browse files
StartAutomatingStartAutomating
authored andcommitted
Adding 'all' keyword (Fixes #244)
1 parent 17ae7ef commit ab57726

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

Transpilers/Keywords/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This directory contains the implementations of PipeScript language keywords.
99

1010
|DisplayName |Synopsis |
1111
|------------------------|-----------------------------------------------|
12+
|[All](All.psx.ps1) |[all keyword](All.psx.ps1) |
1213
|[Assert](Assert.psx.ps1)|[Assert keyword](Assert.psx.ps1) |
1314
|[Await](Await.psx.ps1) |[awaits asynchronous operations](Await.psx.ps1)|
1415
|[New](New.psx.ps1) |['new' keyword](New.psx.ps1) |
@@ -18,6 +19,46 @@ This directory contains the implementations of PipeScript language keywords.
1819

1920
# Examples
2021

22+
## All Example 1
23+
24+
25+
~~~PowerShell
26+
& {
27+
$glitters = @{glitters=$true}
28+
all that glitters
29+
}.Transpile()
30+
~~~
31+
32+
## All Example 2
33+
34+
35+
~~~PowerShell
36+
function mallard([switch]$Quack) { $Quack }
37+
Get-Command mallard | Get-Member | Select-Object -ExpandProperty TypeName -Unique
38+
. {all functions that quack are ducks}.Transpile()
39+
Get-Command mallard | Get-Member | Select-Object -ExpandProperty TypeName -Unique
40+
~~~
41+
42+
## All Example 3
43+
44+
45+
~~~PowerShell
46+
47+
. {
48+
$numbers = 1..100
49+
$null = all $numbers where { ($_ % 2) -eq 1 } are odd
50+
$null = all $numbers where { ($_ % 2) -eq 0 } are even
51+
}.Transpile()
52+
53+
@(
54+
. { all even $numbers }.Transpile()
55+
).Length
56+
57+
@(
58+
. { all odd $numbers }.Transpile()
59+
).Length
60+
~~~
61+
2162
## Assert Example 1
2263

2364

0 commit comments

Comments
 (0)