search.nv(檔案已創建)
| @@ -0,0 +1,55 @@ | |||
| 1 | + | ||:: insert :items: (1 2 foo 3 4) | |
| 2 | + | :: search :for: (1 2 3 4 foo 1 2 3 4 bar) | |
| 3 | + | ||
| 4 | + | ||:@include: lib/rpn.nv | |
| 5 | + | ||
| 6 | + | |:: insert? :items: $x| | |
| 7 | + | :front: $x | |
| 8 | + | |:: insert| | |
| 9 | + | ||
| 10 | + | |:: search? :for: $x| | |
| 11 | + | :: search for $x | |
| 12 | + | |:: search| | |
| 13 | + | ||
| 14 | + | |:: search for $x :found: $x? :bounce:| | |
| 15 | + | |:: search for $x :found: $x?| | |
| 16 | + | ||
| 17 | + | |:: search for $x? :target: front? :front: $x?| | |
| 18 | + | :found: $x | |
| 19 | + | :: count a step | |
| 20 | + | |:: search for $x? :target: front? :front: $y| | |
| 21 | + | :back: $y | |
| 22 | + | :: count a step | |
| 23 | + | ||
| 24 | + | |:: search for $x? :target: back? :back: $x?| | |
| 25 | + | :found: $x | |
| 26 | + | :: count a step | |
| 27 | + | |:: search for $x? :target: back? :back: $y| | |
| 28 | + | :front: $y | |
| 29 | + | :: count a step | |
| 30 | + | ||
| 31 | + | |:: search for $x :target: front :bounce:| | |
| 32 | + | :target: back | |
| 33 | + | :not found: $x | |
| 34 | + | :: count a step | |
| 35 | + | |:: search for $x :target: back :bounce:| | |
| 36 | + | :target: front | |
| 37 | + | :not found: $x | |
| 38 | + | :: count a step | |
| 39 | + | ||
| 40 | + | |:: search for $x? :target: front| | |
| 41 | + | :target: back | |
| 42 | + | :bounce: | |
| 43 | + | |:: search for $x? :target: back| | |
| 44 | + | :target: front | |
| 45 | + | :bounce: | |
| 46 | + | ||
| 47 | + | |:: search for $x?| | |
| 48 | + | :target: front | |
| 49 | + | ||
| 50 | + | |:: count a step :@rpn data: $x| | |
| 51 | + | :steps: $x | |
| 52 | + | |:: count a step? :steps: $x| | |
| 53 | + | :@rpn: ($x 1 +) | |
| 54 | + | |:: count a step?| | |
| 55 | + | :steps: 0 | |
上一頁
下一頁