RProgN , 142 Bytes, No competidor
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
No compite, ya que el comando 'tostack' se agregó después del descubrimiento de este desafío (a pesar de que tiene un recuento de bytes terrible)
Casos de prueba
Hello, World!
-39
Cool, huh?
-4
Explicación
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 es un lenguaje esotérico en el que he estado trabajando teniendo en cuenta la notación polaca inversa. Actualmente es bastante detallado, con una asignación variable de 4 caracteres y, sin embargo, planeo agregar en el futuro un poco de azúcar sintética.
Además, RProgN accede implícitamente a los argumentos de la pila y los devuelve de la misma manera. Cualquier dato de cadena que quede en la pila después de que el programa haya finalizado, se imprime implícitamente.