1

I saw ~.2$<@@if this code being called comparing code.
It does work, but I know @ means

Rotates the top 3 elements of the stack so that the 3rd down is now on top.

and I can't understand how it works.
Can anyone please explain what @ is in this code?
Thank You.

dbld
  • 998
  • 1
  • 7
  • 17

1 Answers1

1

Now I know, @ is literally rotating.
.2$< returns 1 if the left arg is bigger, and 0 if the right one is bigger.
@@ makes the input a b to 1 a b or 0 a b.
The code would say a when the condition is 1, or b when 0.

dbld
  • 998
  • 1
  • 7
  • 17