q / k4(3?5?8?)
如果足以将代码和输入直接输入到REPL中,那就是asc:
q)asc"Johnny walked the dog to the park."
`s#" .Jaaddeeeghhhkklnnoooprtttwy"
的`s#为q的符号的位,表示该字符串以排序的顺序(可以是二进制搜索,等等)。如果必须这样做,则需要花费两个字符,即五个字符:
q)`#asc"Johnny walked the dog to the park."
" .Jaaddeeeghhhkklnnoooprtttwy"
如果您希望在stdin上提供它,那么该切换到k4了(我们`s#免费摆脱了),这是一个八个字符的解决方案:
x@<x:0:0
Johnny walked the dog to the park.
" .Jaaddeeeghhhkklnnoooprtttwy"
btw将完全按原样作为代码文件工作(仍为8个字符,因为q很好,因为代码文件中没有最后的换行符)。通常,欢迎标语和REPL保持打开状态会出现问题,但是如果您将输入作为herestring传递,那么一切都会消失:
$ cat asc.k
x@<x:0:0
$ q asc.k<<<'Johnny walked the dog to the park.'
"\n .Jaaddeeeghhhkklnnoooprtttwy"
$
实际上不确定输出中的多余换行符是从哪里来的。