function tostack 'b' asoc stack 'a' asoc 0 'v' asoc b pop byte 'o' asoc b len while [ v o b pop byte ] 'o' asoc - + 'v' asoc b len end [ v end
非竞争性,因为在发现此挑战后添加了“ tostack”命令(即使它的字节数非常糟糕)
测试用例
Hello, World!
-39
Cool, huh?
-4
说明
function # Push the function between this and end to the stack
tostack 'b' asoc # Convert the implicit input to a stack, associate it with 'b'
0 'v' asoc # Push 0 to the stack, associate it with 'v'
b pop byte 'o' asoc # Pop the top value of b (The end of the input), get the byte value, associate it with 'o'.
b len # Push the size of b to the stack
while [ # While the top of the stack is truthy, pop the top of the stack
v # Push v to the stack
o # Push o to the stack
b pop byte # Pop the top value of b, push the byte value of that to the stack
] 'o' asoc # Push a copy of the top of the stack, associate it with 'o'
- # Subtract the top of the stack from one underneith that, In this case, the old value of o and the byte.
+ # Sum the top of the stack and underneith that, that is, the difference of the old value and new, and the total value
'v' asoc # Associate it with 'v'
b len # Push the size of b to the stack (which acts as the conditional for the next itteration)
end [ # Pop the top of the stack, which will likely be the left over size of b
v # Push the value of v to the top of the stack
end # Implicitely returned / printed
RProgN是我一直在研究的一种深奥的语言,它使用了波兰语反向符号。它目前非常冗长,其变量赋值为4个字符,因此,我计划将来再添加一些语法糖。
同样,RProgN隐式地从堆栈访问参数,并以相同的方式返回它们。程序完成后,堆栈中剩余的任何字符串数据都将隐式打印。