Input 从J中的行读取输入
我对J(学习它是为了好玩)非常陌生,我正在尝试从键盘读取数据。我试着制作一个小脚本,读取字符串并反转它:Input 从J中的行读取输入,input,j,Input,J,我对J(学习它是为了好玩)非常陌生,我正在尝试从键盘读取数据。我试着制作一个小脚本,读取字符串并反转它: |.(1!:1 3) 当我运行它时,我得到一个等级错误。(我用1!:13代替定义动词,因为codegolf…) 是否有可以检查排名1的命令!:这是外国人常犯的错误 对于外部1!:1没有帮助,因为它实际上是: 1!:1 y Read. y is a file name or a file number (produced by 1!:21); the result is a st
|.(1!:1 3)
当我运行它时,我得到一个等级错误。(我用1!:13代替定义动词,因为codegolf…)
是否有可以检查排名1的命令!:这是外国人常犯的错误 对于外部
1!:1
没有帮助,因为它实际上是:
1!:1 y Read. y is a file name or a file number (produced by 1!:21); the
result is a string of the file contents., e.g. 1!:1 <'abc.q'. The following
values for y are also permitted:
1 read from the keyboard (does not work within a script)
3 read from standard input (stdin)
是由13
组成的数组。有点像给它:
1!:(1 3)
当您需要时:
1!:1 (3)
对于代码高尔夫,请使用右括号:
1!:1]3
正如@MPelletier所指出的,秩错误是由于括号错误造成的,但为了将来参考,请使用检查动词的秩:
(1!:1)b。0
具有0 0
。
1!:1]3