Skip to content

2over

Input Stack:
top: Any
second: Any
 
 
Output Stack:
top: Any
second: Any
top: Any
second: Any

Copy both items from the stack and place copies on top. This operator provides a convenient way to duplicate both items on a two-item stack. It's equivalent to the sequence :over,:over but more clearly expresses the intent to copy both items.

Parameters

  • top: The item on top of the stack (will be copied)
  • second: The second item from the top (will be copied)

Examples

Copying two items from deeper stack positions:

a,b,:2over
PosInputOutput
0 b b
1 a a
2 b
3 a

Equivalent Sequence

The :2over operation is exactly equivalent to:

:over,:over

Both sequences produce the same result, but :2over is more concise and clearly indicates the intent to copy two items from deeper positions.

  • :over - Copy single item from second position (component operation)
  • :pick - Copy item from arbitrary position (more general)
  • :dup - Copy top item only
  • :nip - Remove second item (opposite of adding)
  • :tuck - Copy top item to third position