Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

edited body
Source Link
H.PWiz
  • 11.7k
  • 2
  • 23
  • 57

Brain-Flak, 6 bytes

My first Brain-Flak solution worthy posting, I guess it's the right tool for this job:

([]<>)

Try it online!

Explanation

When executing a Brain-Flak program, initially the left stack contains all arguments. From there it's simply a matter of:

( -- push the following..
 [] -- height of the stack (ie. # of arguments)
 {}<> -- ..to the other stack (toggles to the other stack)
) --
 -- the right stack now contains the # of arguments which
 -- gets printed implicitly

Brain-Flak, 6 bytes

My first Brain-Flak solution worthy posting, I guess it's the right tool for this job:

([]<>)

Try it online!

Explanation

When executing a Brain-Flak program, initially the left stack contains all arguments. From there it's simply a matter of:

( -- push the following..
 [] -- height of the stack (ie. # of arguments)
 {} -- ..to the other stack (toggles to the other stack)
) --
 -- the right stack now contains the # of arguments which
 -- gets printed implicitly

Brain-Flak, 6 bytes

My first Brain-Flak solution worthy posting, I guess it's the right tool for this job:

([]<>)

Try it online!

Explanation

When executing a Brain-Flak program, initially the left stack contains all arguments. From there it's simply a matter of:

( -- push the following..
 [] -- height of the stack (ie. # of arguments)
 <> -- ..to the other stack (toggles to the other stack)
) --
 -- the right stack now contains the # of arguments which
 -- gets printed implicitly
Source Link
ბიმო
  • 17k
  • 3
  • 43
  • 106

Brain-Flak, 6 bytes

My first Brain-Flak solution worthy posting, I guess it's the right tool for this job:

([]<>)

Try it online!

Explanation

When executing a Brain-Flak program, initially the left stack contains all arguments. From there it's simply a matter of:

( -- push the following..
 [] -- height of the stack (ie. # of arguments)
 {} -- ..to the other stack (toggles to the other stack)
) --
 -- the right stack now contains the # of arguments which
 -- gets printed implicitly

AltStyle によって変換されたページ (->オリジナル) /