Skip to main content
better explanation
Source Link
chunes
  • 27.9k
  • 3
  • 32
  • 55

Factor + combinators.extras, 4242 35 bytes

0 [ read1 ch>lower 9632 -mod dup . + ] thrice .

Try it online!Try it online!

-7 bytes thanks to @MarcMush

  • 0 Push 0, our sum, to the data stack.
  • [ ... ] thrice Call a quotation three times.
  • read1 Read one bytecode point from standard input.
  • ch>lower Make it lowercase, e.g. 65 -> 97 or 97 -> 97.
  • 9632 -mod Subtract 96 from itModulo 32.
  • dup . Output on its own line non-destructively.
  • + Add it to the sum.
  • . Print the sum.

Factor + combinators.extras, 42 bytes

0 [ read1 ch>lower 96 - dup . + ] thrice .

Try it online!

  • 0 Push 0, our sum, to the data stack.
  • [ ... ] thrice Call a quotation three times.
  • read1 Read one byte from standard input.
  • ch>lower Make it lowercase, e.g. 65 -> 97 or 97 -> 97.
  • 96 - Subtract 96 from it.
  • dup . Output on its own line non-destructively.
  • + Add it to the sum.
  • . Print the sum.

Factor + combinators.extras, 42 35 bytes

0 [ read1 32 mod dup . + ] thrice .

Try it online!

-7 bytes thanks to @MarcMush

  • 0 Push 0, our sum, to the data stack.
  • [ ... ] thrice Call a quotation three times.
  • read1 Read one code point from standard input.
  • 32 mod Modulo 32.
  • dup . Output on its own line non-destructively.
  • + Add it to the sum.
  • . Print the sum.
Source Link
chunes
  • 27.9k
  • 3
  • 32
  • 55

Factor + combinators.extras, 42 bytes

0 [ read1 ch>lower 96 - dup . + ] thrice .

Try it online!

  • 0 Push 0, our sum, to the data stack.
  • [ ... ] thrice Call a quotation three times.
  • read1 Read one byte from standard input.
  • ch>lower Make it lowercase, e.g. 65 -> 97 or 97 -> 97.
  • 96 - Subtract 96 from it.
  • dup . Output on its own line non-destructively.
  • + Add it to the sum.
  • . Print the sum.