"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Sort_1 = require("../../../../system/f/array/Sort");
const assert_1 = require("../../../../util/assert");
const system_1 = require("../../../util/system");
const sort = new Sort_1.default(system_1.system);
sort.play();
let i = undefined;
let j = undefined;
let p = () => {
    if (i !== undefined && j !== undefined) {
        i = undefined;
        j = undefined;
        sort.push('a[i] < a[j]', sort.peak('a[i]') < sort.peak('a[j]'));
        sort.take('a[i]');
        sort.take('a[j]');
    }
};
sort.getOutput('a[i]').addListener('data', (data) => {
    i = data;
    p();
});
sort.getOutput('a[j]').addListener('data', (data) => {
    j = data;
    p();
});
sort.getOutput('b').addListener('data', (data) => {
    assert_1.assert.deepEqual(sort.take('b'), [1, 2, 3]);
});
sort.push('a', [3, 2, 1]);
//# sourceMappingURL=Sort.js.map