shiro #178(2007/07/05 07:54 GMT) [ Scheme ] Rating2/2=1.00
1 2 3 4
(define (pyramid n) (define (p s n) (q (regexp-replace* s #/ \*/ "***" #/ $/ "*") n)) (define (q s n) (when (> n 0) (print s) (p s (- n 1)))) (p (make-string n) n))
Rating2/2=1.00-0+
1 reply [ reply ]
shiro #180(2007/07/05 08:06 GMT) [ sed ] Rating1/1=1.00
同じアイディアをsedで。 ピラミッドの段数分のスペースからなる行を標準入力から与えます。 $ echo " " | sed -n -f t.sed * *** ***** ******* *********
s/ $/*/p :x s/ \*/***/p tx
Rating1/1=1.00-0+
[ reply ]
shiro
#178()
[
Scheme
]
Rating2/2=1.00
Rating2/2=1.00-0+
1 reply [ reply ]