From Esolang
Jump to navigation Jump to search

DQ is a esolang about duplicate and discard

esolang overview


DQ uses a minimal stack-based approach. The only symbols are:

symbol description
0 represents an empty stack
1 pushes a 1 onto the stack
D duplicates the top element on the stack
Q discards the top element on the stack

execution model

  • Start with an empty stack.
  • Read the DQ program character by character in random order.
  • After processing the entire program, the final stack contents represent the output.




  • 1: Push a 1 onto the stack (stack: 1).
  • 1: Push another 1 onto the stack (stack: 1, 1).
  • D: Duplicate the top 1 (stack: 1, 1, 1, 1).
  • Q: Discard the top element (stack: 1, 1, 1).

Final output: 1, 1, 1 (if it goes in right direction).

Key Features:

  • Duplication: The D instruction effectively doubles the size of the stack (up to the current stack pointer) at a specific point.
  • Discarding: The Q instruction removes the top element, allowing for selective removal and manipulation of stack contents.
  • All operations happen in a random order