Paste: minheap bug ?!

Author: jon
Mode: factor
Date: Fri, 4 Jan 2019 13:17:54
Plain Text |
:: foo ( -- )
0 :> curmin!
<min-heap> :> heap
t 0 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 1 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 1 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 7 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 2 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 2 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 8 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 2 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 8 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 3 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 3 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 9 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 9 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 3 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 9 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 4 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 4 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 10 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 10 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 4 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 10 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 5 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 5 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 11 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 11 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 5 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 11 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 6 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 6 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 12 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 6 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 12 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 12 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 13 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 13 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 7 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 7 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 13 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 8 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 8 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 8 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 14 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 14 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 9 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 9 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 15 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 15 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 9 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 15 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 10 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 10 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 16 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 10 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 16 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 10 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 16 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 10 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 11 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 17 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 11 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 17 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 11 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 17 dup curmin < [ "bad testcase" throw ] when heap heap-push* :> D0
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 17 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 11 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 17 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 18 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 12 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 12 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 18 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 18 dup curmin < [ "bad testcase" throw ] when heap heap-push* :> D1
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 12 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 12 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 18 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 12 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
D0 heap heap-delete
t 12 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 13 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 13 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 13 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 19 dup curmin < [ "bad testcase" throw ] when heap heap-push* :> D2
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
D1 heap heap-delete
t 13 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 13 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 19 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 13 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 19 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 13 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 19 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 13 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 13 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 19 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
D2 heap heap-delete
t 14 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 14 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 14 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 14 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 14 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 20 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 14 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 14 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 20 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 14 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 14 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 14 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 14 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 20 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 20 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 14 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 14 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap heap-pop dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop
t 14 dup curmin < [ "bad testcase" throw ] when heap heap-push 
t 20 dup curmin < [ "bad testcase" throw ] when heap heap-push 
heap [ dup curmin < [ pprint " << !!" print ] [ dup curmin! . ] if drop ] slurp-heap ;

Annotation: raw

Author: jon
Mode: factor
Date: Fri, 4 Jan 2019 13:19:40
Plain Text |
:: foo ( -- )
<min-heap> :> heap
t 0 heap heap-push 
heap heap-pop . drop
t 1 heap heap-push 
t 1 heap heap-push 
t 7 heap heap-push 
heap heap-pop . drop
t 2 heap heap-push 
t 2 heap heap-push 
t 8 heap heap-push 
heap heap-pop . drop
t 2 heap heap-push 
t 8 heap heap-push 
heap heap-pop . drop
t 3 heap heap-push 
t 3 heap heap-push 
t 9 heap heap-push 
heap heap-pop . drop
t 9 heap heap-push 
heap heap-pop . drop
t 3 heap heap-push 
t 9 heap heap-push 
heap heap-pop . drop
t 4 heap heap-push 
t 4 heap heap-push 
t 10 heap heap-push 
heap heap-pop . drop
t 10 heap heap-push 
heap heap-pop . drop
t 4 heap heap-push 
t 10 heap heap-push 
heap heap-pop . drop
t 5 heap heap-push 
t 5 heap heap-push 
t 11 heap heap-push 
heap heap-pop . drop
t 11 heap heap-push 
heap heap-pop . drop
t 5 heap heap-push 
t 11 heap heap-push 
heap heap-pop . drop
t 6 heap heap-push 
t 6 heap heap-push 
t 12 heap heap-push 
heap heap-pop . drop
t 6 heap heap-push 
t 12 heap heap-push 
heap heap-pop . drop
t 12 heap heap-push 
heap heap-pop . drop
t 13 heap heap-push 
heap heap-pop . drop
t 13 heap heap-push 
heap heap-pop . drop
t 7 heap heap-push 
t 7 heap heap-push 
t 13 heap heap-push 
heap heap-pop . drop
heap heap-pop . drop
t 8 heap heap-push 
t 8 heap heap-push 
t 8 heap heap-push 
t 14 heap heap-push 
heap heap-pop . drop
t 14 heap heap-push 
heap heap-pop . drop
heap heap-pop . drop
t 9 heap heap-push 
t 9 heap heap-push 
t 15 heap heap-push 
heap heap-pop . drop
heap heap-pop . drop
t 15 heap heap-push 
heap heap-pop . drop
t 9 heap heap-push 
t 15 heap heap-push 
heap heap-pop . drop
heap heap-pop . drop
t 10 heap heap-push 
t 10 heap heap-push 
t 16 heap heap-push 
heap heap-pop . drop
t 10 heap heap-push 
t 16 heap heap-push 
heap heap-pop . drop
t 10 heap heap-push 
t 16 heap heap-push 
heap heap-pop . drop
heap heap-pop . drop
t 10 heap heap-push 
heap heap-pop . drop
heap heap-pop . drop
t 11 heap heap-push 
heap heap-pop . drop
t 17 heap heap-push 
heap heap-pop . drop
t 11 heap heap-push 
t 17 heap heap-push 
heap heap-pop . drop
t 11 heap heap-push 
t 17 heap heap-push* :> D0
heap heap-pop . drop
heap heap-pop . drop
t 17 heap heap-push 
heap heap-pop . drop
t 11 heap heap-push 
t 17 heap heap-push 
heap heap-pop . drop
heap heap-pop . drop
t 18 heap heap-push 
heap heap-pop . drop
t 12 heap heap-push 
t 12 heap heap-push 
t 18 heap heap-push 
heap heap-pop . drop
t 18 heap heap-push* :> D1
heap heap-pop . drop
t 12 heap heap-push 
t 12 heap heap-push 
t 18 heap heap-push 
heap heap-pop . drop
t 12 heap heap-push 
heap heap-pop . drop
D0 heap heap-delete
t 12 heap heap-push 
heap heap-pop . drop
t 13 heap heap-push 
t 13 heap heap-push 
heap heap-pop . drop
heap heap-pop . drop
t 13 heap heap-push 
t 19 heap heap-push* :> D2
heap heap-pop . drop
D1 heap heap-delete
t 13 heap heap-push 
heap heap-pop . drop
t 13 heap heap-push 
t 19 heap heap-push 
heap heap-pop . drop
t 13 heap heap-push 
t 19 heap heap-push 
heap heap-pop . drop
t 13 heap heap-push 
t 19 heap heap-push 
heap heap-pop . drop
heap heap-pop . drop
t 13 heap heap-push 
t 13 heap heap-push 
t 19 heap heap-push 
heap heap-pop . drop
D2 heap heap-delete
t 14 heap heap-push 
t 14 heap heap-push 
t 14 heap heap-push 
heap heap-pop . drop
t 14 heap heap-push 
t 14 heap heap-push 
t 20 heap heap-push 
heap heap-pop . drop
heap heap-pop . drop
t 14 heap heap-push 
t 14 heap heap-push 
t 20 heap heap-push 
heap heap-pop . drop
t 14 heap heap-push 
heap heap-pop . drop
t 14 heap heap-push 
t 14 heap heap-push 
heap heap-pop . drop
t 14 heap heap-push 
heap heap-pop . drop
t 20 heap heap-push 
heap heap-pop . drop
t 20 heap heap-push 
heap heap-pop . drop
t 14 heap heap-push 
t 14 heap heap-push 
heap heap-pop . drop
t 14 heap heap-push 
t 20 heap heap-push 
heap [ . drop ] slurp-heap ;

Annotation: output

Author: jonenst
Mode: factor
Date: Fri, 4 Jan 2019 13:37:50
Plain Text |
factor dbb9bb42cae3e9c0b6b92d580fa66afe15f2b614

(scratchpad) foo
0
1
1
2
2
2
3
3
3
4
4
4
5
5
5
6
6
6
7
7
7
8
8
8
8
8
9
9
9
9
9
9
10
10
10
10
10
10
10
10
11
11
11
11
11
11
11
12
12
12
12
12
12
12
12
12
13
13
13
13
13
13
13
13
13
13
13
14
14
14
14
14
14
14
14
14
14
14
14
14
14
13 << !!
14
14
15
15
15
16
16
17
17
17
17
16 << !!
18
18
18
19
19
19
19
20
20
20
20
20

New Annotation

Summary:
Author:
Mode:
Body: