Created
February 16, 2017 07:57
-
-
Save Xainey/5b0c464e71d2c95ba6581f8b2bc98b46 to your computer and use it in GitHub Desktop.
Revisions
-
Xainey created this gist
Feb 16, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ $stack = New-Object System.Collections.Stack function I { if($args[$args.Count - 1]){ $stack.push($args[$args.Count - 1]) } } function UH! { if($stack.Count -ge 2){ $r = "{0}-{1}!" -f $stack.Pop(), $stack.Pop() if($stack.count -eq 0){ $stack.Push($r) } } elseif($stack.Count -eq 1){ $r = $stack.Peek() } Write-Host $r -ForegroundColor Green # return $r } function _ ($arr){ $stack.Clear() for($i = 0; $i -lt $arr.count; $i++){ $pieces = $arr[$i] -split "-" if($i % 2 -ne 0){ [array]::Reverse($pieces) } $stack.Push($pieces -join "-") } }