あなごる reverse entire input
http://www.shinh.org/p.rb?reverse+entire+input
echoを改造して
wwWWwWWWwv ;2 Wwww ;2succ WWw ;4succ WWWw ;8succ Wwwwwwww ;(8succ w) -> del vw ;main (self) WWWWWWWWWWww ;(in del) -> eof?del:input WWWw ;(del 1) -> eof?true:false Ww ;(1 1) -> eof?(true true):(false false) Wwwww ;(1 self) -> eof?true:self Ww ;(1 1) -> eof?(true true):(self self) WWWwwwwwwwwwwww ;(3 out) -> eof?true:out Wwwwwww ;(1 input) -> eof?(true del):(out input)
コメント・改行削って78byte。
del(0x7f)使わないで何とかならんかなと試行錯誤した結果
;grass.el用擬似コード '( (abs true (d) ((app w w) )) (abs main (self) ((app in true) ; eof?true:input (app 1 1) ; eof?(true true):true (app 1 self) ; eof?true:(true self) (app 1 1) ; eof?(true true):self (app 1 1) ; eof?true:(self self) (app 4 out) ; eof?true:(true out) (app 1 1) ; eof?(true true):out (app 1 7) ; eof?true:(out input) )) )
plant後、最初のwWWWWwwwをWWWwwwにして48byte。
まだ短くなるかなこれ。
追記
最初のwまでは無視されちゃうよ、とirieさんの指摘。すっかり忘れてた。
しかしそれで動いちゃったのは予期せぬ収穫。
;grass.el用擬似コード '( (abs 3rd (s t u) ; λs t u . u ()) (abs main (self) ((app in l3) ; eof?3rd:input (app 1 1) ; eof?(3rd 3rd):true (app 1 self) ; eof?(3rd 3rd self):(true self) (app 1 1) ; eof?(3rd 3rd self):self (app 1 1) ; eof?(3rd 3rd self):(self self) (app 4 out) ; eof?(3rd 3rd out):(true out) (app 1 1) ; eof?(3rd 3rd out):out (app 1 7) ; eof?input:(out input) )) )
なんだこれおもしれーwww
whenとかunlessみたいな感じの処理書きたいときに必要な数wを並べとけばよいのかな。