Skip to main content
Improve the explanation
Source Link
chunes
  • 26.8k
  • 3
  • 24
  • 53

Factor + math.unicode, 13 bytes

[ Σ dup .o ]

Try it online!

Explanation:

It's a function that takes a sequence as input, prints its sum in octal, and returns the decimal sum as output.

  • [ ... ] A quotation. An anonymous function that lives on the data stack until called or used by a combinator.
  • Σ take the sum of a sequence (a string is a sequence of unicode code points)
  • dup duplicate object on top of the data stack
  • .o print as octal

Factor + math.unicode, 13 bytes

[ Σ dup .o ]

Try it online!

Explanation:

It's a function that takes a sequence as input, prints its sum in octal, and returns the decimal sum as output.

  • Σ take the sum of a sequence (a string is a sequence of unicode code points)
  • dup duplicate object on top of the data stack
  • .o print as octal

Factor + math.unicode, 13 bytes

[ Σ dup .o ]

Try it online!

Explanation:

It's a function that takes a sequence as input, prints its sum in octal, and returns the decimal sum as output.

  • [ ... ] A quotation. An anonymous function that lives on the data stack until called or used by a combinator.
  • Σ take the sum of a sequence (a string is a sequence of unicode code points)
  • dup duplicate object on top of the data stack
  • .o print as octal
Source Link
chunes
  • 26.8k
  • 3
  • 24
  • 53

Factor + math.unicode, 13 bytes

[ Σ dup .o ]

Try it online!

Explanation:

It's a function that takes a sequence as input, prints its sum in octal, and returns the decimal sum as output.

  • Σ take the sum of a sequence (a string is a sequence of unicode code points)
  • dup duplicate object on top of the data stack
  • .o print as octal