PoshCode Archive  Artifact Content

Artifact 2a6bdc2ac189b03833739338a27d2d3f55652dcdeb0599be00f6e6b0d0f6680f:

  • File The-Letter-Diamond-Oneli.ps1 — part of check-in [f860ef9b74] at 2018-06-10 12:56:17 on branch trunk — @CAMurphy A slightly more elegant PowerShell version for his challenge (user: Joel Bennett size: 585)

# encoding: ascii
# api: powershell
# title: The Letter Diamond Oneli
# description: @CAMurphy A slightly more elegant PowerShell version for his challenge
# version: 0.1
# author: Joel Bennett
# license: CC0
# x-poshcode-id: 1032
# x-archived: 2017-04-08T23:54:57
# x-published: 2010-04-15T15:59:00
#
# -Refactored Jaykuls down to a 1 liner, but couldn’t get it smaller than a twitter message length
#
&{Param([char]$l)$s=66;$z=[int]$l;$o=$z-$s+ 5;$p=-1;$n=&{"$(" "*$o)A";([string[]][char[]]($s..$z))|%{$p+=2;$o--;"$(" "*$o)$_$(" "*$p)$_"}};$n;$n[$($n.Length-2)..0]}L