点 -l
,35字节
(^YsXbRLaJW'-)XbWR^('|XbRLaJ'+)WR'o
在线尝试!
说明
(^YsXbRLaJW'-)XbWR^('|XbRLaJ'+)WR'o
a is length, b is size, s is space (implicit)
sXb String containing b spaces
RLa List containing a copies of that string
JW'- Join on "-" and wrap the result in "-" as well
Y Necessary for operator precedence reasons
^ Split into a list of characters
( )Xb String-repeat each character in the list b times
This list represents the central columns of the ladder
'|Xb String containing b pipe characters
RLa List containing a copies of that string
J'+ Join on "+"
( )WR'o Wrap in "o"
^ Split into a list of characters
This list represents the outer columns of the ladder
WR Wrap the left list in the right list, vectorizing
其他一些版本
我尝试了多种方法来捕捉Pyth ...
[Y'-XbWR'o;@>(sXbWR'|RLbPE'-XbWR'+RL:a)y] 41
Y^(t**b.1*:t**bX--a.1)" --"@yXbWR"|o+"@y 40
Y'|XbRLaJ'+YyWR'o;Z:sXbRLaJW'-RLbPEyAEy 39
t**:b(" |-o-+"<>2)@_@^t.1M$*Y[ttXa-1].1 39
J*Z:sXbRLaJW'-RLbWR:^('|XbRLaJ'+)WR'o 37
Y^$*Y[t**:btXa-1].1" --"@yXbWR"|o+"@y 37
我特别喜欢t**b
使用数学生成梯子的垂直模式的代码:
b Size; e.g. 3
t Preset variable for 10
**: Set t to t**b (e.g. 1000)
a Length; e.g. 3
-1 2
tX String-repeat (the new value of) t 2 times: 10001000
[ ] Put t and the above into a list: [1000; 10001000]
.1 Append 1 to both of them: [10001; 100010001]
$*( ) Fold on multiplication: 1000200020001
所述1000200020001
然后可以用来产生图案o|||+|||+|||o
和- - - -
,从而弥补了阶梯。不幸的是,我无法使这种方法比联接/包装方法更短。