Skip to content

dup

Input Stack:
item: Any
 
Output Stack:
item: Any
item: Any

Duplicates the item on the top of the stack, pushing a copy of it onto the stack. This is commonly used when you need to apply multiple operations to the same value or expression.

Parameters

  • item: Any value or expression that will be duplicated

Examples

Basic duplication of a time expression:

BeforeAfter
minuteOfDay,:time
minuteOfDay,:time,
:dup

Common pattern for applying multiple aggregations to the same query:

BeforeAfter
name,sps,:eq,
:sum
name,sps,:eq,
:dup,
:sum,
:swap,
:count,
:div
  • :over - Copy the second item to the top
  • :swap - Exchange the top two stack items
  • :tuck - Copy the top item to the third position