||:: insert :items: (1 2 foo 3 4) :: search :for: (1 2 3 4 foo 1 2 3 4 bar) ||:@include: lib/rpn.nv |:: insert? :items: $x| :front: $x |:: insert| |:: search? :for: $x| :: search for $x |:: search| |:: search for $x :found: $x? :bounce:| |:: search for $x :found: $x?| |:: search for $x? :target: front? :front: $x?| :found: $x :: count a step |:: search for $x? :target: front? :front: $y| :back: $y :: count a step |:: search for $x? :target: back? :back: $x?| :found: $x :: count a step |:: search for $x? :target: back? :back: $y| :front: $y :: count a step |:: search for $x :target: front :bounce:| :target: back :not found: $x :: count a step |:: search for $x :target: back :bounce:| :target: front :not found: $x :: count a step |:: search for $x? :target: front| :target: back :bounce: |:: search for $x? :target: back| :target: front :bounce: |:: search for $x?| :target: front |:: count a step :@rpn data: $x| :steps: $x |:: count a step? :steps: $x| :@rpn: ($x 1 +) |:: count a step?| :steps: 0