#[unsafe(no_mangle)]pub unsafe extern "C" fn patch_seq_pick_op(stack: Stack) -> StackExpand description
Pick operation exposed to compiler
Copies a value from depth n to the top of the stack.
Stack effect: ( ..stack n – ..stack value ) where n is how deep to look (0 = top, 1 = second, etc.)
§Examples
10 20 30 0 pick # Stack: 10 20 30 30 (pick(0) = dup)
10 20 30 1 pick # Stack: 10 20 30 20 (pick(1) = over)
10 20 30 2 pick # Stack: 10 20 30 10 (pick(2) = third)§Common Equivalences
pick(0)is equivalent todup- copy top valuepick(1)is equivalent toover- copy second valuepick(2)copies third value (sometimes called “third”)pick(n)copies value at depth n
§Use Cases
Useful for building stack utilities like:
third:2 pick- access third item3dup:2 pick 2 pick 2 pick- duplicate top three items- Complex stack manipulations without excessive rot/swap
§Safety
Stack must have at least one value (the Int n), and at least n+1 values total