s LearnSqueak.com

ALGORITHMS · RANGE UNION

Merge overlapping intervals: build a clean union

Sort closed ranges, merge their coverage in one pass, and test touching endpoints, nested ranges, input validation and independent output copies in Squeak.

13 runnable checkpointsClosed integer endpoints6 native visual states

Before you start

  • Use a learning copy of Squeak 6.1. These examples require no installed packages or external data.
  • Know Arrays, OrderedCollection, blocks, comparisons, and loops. This lesson uses sorting as a tool but teaches a distinct range-union algorithm.
  • In a Workspace, paste one complete checkpoint including temporary declarations, select it all, and choose Print It. Every checkpoint is self-contained.
  • If you adapt a checkpoint, do not redeclare an outer temporary as a nested block argument or temporary. Squeak rejects that variable shadowing.
  • An expected result is explanatory text, not part of the expression. Inspect It is convenient for the longer trace.
  • Open merging-intervals.st as text and copy the entire file into a Workspace to run the complete verification bundle. It is a single Workspace expression, not class-definition file-in syntax. Print It should answer 13 if every checkpoint matches; a mismatch signals an Error with the checkpoint name. The bundle returned 13 in native Squeak 6.1 on 2026-10-25.

Helpful preparation: collections, blocks, and sorting. These are native Squeak Workspace examples, not a preloaded SqueakJS playground demo.

Download the complete 13-check verification bundle · Download the native visual trace · All 13 independent expressions and expected answers

The downloadable .st files are complete Workspace expressions, not class-definition file-ins. Open as text, copy the entire expression into a Workspace, select all and choose Print it for the checks or Do it for the visual trace. Neither example reads external data, uses the network, installs a package, or saves your image.

Our exact contract

Each range is an Array #(start end) of Integer endpoints satisfying start <= end. It denotes a closed segment on a real number line. Touching endpoints merge, duplicates disappear, negative endpoints are allowed, empty input returns #(), and output pairs are new objects. No source pair is edited. Calendar dates, time zones, labels, open endpoints, and NaN values are outside this lesson’s contract.

01 · Define the range contract first

Represent a closed numeric range with a two-element Array: #(start end). Both endpoints belong to the range. Here the endpoints are Integers, but the covered domain is the real number line, not only integer positions. A range #(4 4) covers one point and has zero length. This representation is not Squeak’s Interval collection, which enumerates a sequence.

Run: Workspace → select the complete expression → Print It.

Independent Workspace expression · select all, then Print it
| range contains |
range := #(-2 4).
contains := [:point | range first <= point and: [point <= range second]].
{contains value: -2. contains value: 4. contains value: 5}

Expected result (verified in Squeak 6.1):

Expected answer · compare, do not paste
#(true true false)

The convention matters: two closed ranges that share an endpoint overlap at that point. Later comparisons deliberately merge #(1 4) and #(4 7). We will not merge #(1 3) and #(4 7), since there is a positive gap between them.

NATIVE SQUEAK CAPTURE
Squeak Workspace after checkpoint 1: Define the range contract first, with the verified answer selected
Genuine native Squeak Workspace capture after Print it; the blue selection is the actual computed answer.

02 · Distinguish overlap, touching, and a gap

Two closed ranges overlap when each starts no later than the other ends. This symmetric test works without sorting and is useful for checking the domain rule.

Run: Workspace → select the complete expression → Print It.

Independent Workspace expression · select all, then Print it
| overlaps |
overlaps := [:left :right |
    left first <= right second and: [right first <= left second]].
{overlaps value: #(1 4) value: #(4 7).
 overlaps value: #(1 3) value: #(4 7).
 overlaps value: #(1 9) value: #(3 5)}

Expected result (verified in Squeak 6.1):

Expected answer · compare, do not paste
#(true false true)

Touching endpoints count as overlap; a gap does not. The third case is containment. For a scheduling policy using half-open ranges, touching events need not conflict; do not silently reuse this closed-range conflict rule for that different problem.

NATIVE SQUEAK CAPTURE
Squeak Workspace after checkpoint 2: Distinguish overlap, touching, and a gap, with the verified answer selected
Genuine native Squeak Workspace capture after Print it; the blue selection is the actual computed answer.

03 · Sort by start, then end

The main algorithm wants the earliest start first. A secondary comparison by end makes equal starts predictable. asSortedCollection: returns a sorted collection; it does not rearrange the source Array. The comparator uses <= for equal endpoints, matching the non-strict ordering convention used here.

Run: Workspace → select the complete expression → Print It.

Independent Workspace expression · select all, then Print it
| ranges sorted |
ranges := #((9 12) (1 3) (2 6) (15 17) (12 14) (2 4)).
sorted := ranges asSortedCollection: [:left :right |
    left first < right first or: [
        left first = right first and: [left second <= right second]]].
sorted asArray

Expected result (verified in Squeak 6.1):

Expected answer · compare, do not paste
#(#(1 3) #(2 4) #(2 6) #(9 12) #(12 14) #(15 17))

Once starts are sorted, a new start beyond the active end proves that every later range also starts beyond that end. That is the reason one active merged range is enough. This is a union problem, not the problem of choosing the maximum number of compatible appointments.

NATIVE SQUEAK CAPTURE
Squeak Workspace after checkpoint 3: Sort by start, then end, with the verified answer selected
Genuine native Squeak Workspace capture after Print it; the blue selection is the actual computed answer.

04 · Extend the active end without shrinking it

If a new range overlaps the active one, retain the active start and take the larger end. Never blindly replace the active end: a contained range could otherwise shrink coverage that has already been found. The braces create a new Array that is safe to edit.

Run: Workspace → select the complete expression → Print It.

Independent Workspace expression · select all, then Print it
| active next |
active := {1. 6}.
next := #(2 4).
next first <= active second ifTrue: [
    active at: 2 put: (active second max: next second)].
active

Expected result (verified in Squeak 6.1):

Expected answer · compare, do not paste
#(1 6)

Try changing next to #(4 9): the result should become #(1 9). Change it to #(8 10) and the overlap branch should not run. The complete scan must append a new range in that case.

NATIVE SQUEAK CAPTURE
Squeak Workspace after checkpoint 4: Extend the active end without shrinking it, with the verified answer selected
Genuine native Squeak Workspace capture after Print it; the blue selection is the actual computed answer.

05 · Merge in one left-to-right pass

The output keeps completed ranges plus one active range at the end. If the next start is beyond the active end, append a fresh pair. Otherwise extend the active end. The or: block is lazy: on an empty result it does not try to send last to that empty collection.

Run: Workspace → select the complete expression → Print It.

Independent Workspace expression · select all, then Print it
| merge |
merge := [:inputRanges |
    | sortedRanges mergedRanges |
    sortedRanges := inputRanges asSortedCollection: [:earlierRange :laterRange |
        earlierRange first < laterRange first or: [
            earlierRange first = laterRange first and: [earlierRange second <= laterRange second]]].
    mergedRanges := OrderedCollection new.
    sortedRanges do: [:candidateRange |
        (mergedRanges isEmpty or: [candidateRange first > mergedRanges last second])
            ifTrue: [mergedRanges add: {candidateRange first. candidateRange second}]
            ifFalse: [mergedRanges last at: 2
                put: (mergedRanges last second max: candidateRange second)]].
    mergedRanges asArray].
merge value: #((9 12) (1 3) (2 6) (15 17) (12 14) (2 4))

Expected result (verified in Squeak 6.1):

Expected answer · compare, do not paste
#(#(1 6) #(9 14) #(15 17))

After each input, the result is the union of everything seen so far. Every output range except the last is finished: no later start can reach back across the gap that closed it. The current last range may still grow. Creating each output pair with braces prevents mutations of input pairs.

06 · Trace the evolving output safely

Each row contains {range just read. output after reading it}. Copy every current output pair before saving the trace row. Otherwise earlier trace rows would point at the same active Array and appear to change when later ranges extend it.

Run: Workspace → select the complete expression → Print It.

Independent Workspace expression · select all, then Print it
| ranges sorted merged trace |
ranges := #((9 12) (1 3) (2 6) (15 17) (12 14) (2 4)).
sorted := ranges asSortedCollection: [:left :right |
    left first < right first or: [
        left first = right first and: [left second <= right second]]].
merged := OrderedCollection new.
trace := OrderedCollection new.
sorted do: [:range |
    (merged isEmpty or: [range first > merged last second])
        ifTrue: [merged add: {range first. range second}]
        ifFalse: [merged last at: 2
            put: (merged last second max: range second)].
    trace add: {range copy. (merged collect: [:pair | pair copy]) asArray}].
trace asArray

Expected result (verified in Squeak 6.1):

Expected answer · compare, do not paste
#(#(#(1 3) #(#(1 3))) #(#(2 4) #(#(1 4))) #(#(2 6) #(#(1 6))) #(#(9 12) #(#(1 6) #(9 12))) #(#(12 14) #(#(1 6) #(9 14))) #(#(15 17) #(#(1 6) #(9 14) #(15 17))))

The input #(12 14) joins #(9 12) because they touch at 12. Saving all snapshots can require quadratic storage, unlike the linear-storage merge itself. Use the trace to learn or debug, then remove it from the production path.

Watch six decisions build the union

The green row marks the candidate currently being processed. Gray rows are already processed; pale rows are still waiting. The lower green line is the output after that candidate. Every filled endpoint belongs to its range.

To make this view yourself, open the downloaded visual-trace.st as text, copy the full expression into Workspace, and Do it. Change its stage := 1. assignment to a number from 1 through 6 to choose the state. Close the previous Morph with its halo before opening the next one. This view computes the same sorted scan; it does not load a pre-rendered diagram.

1 · First range opens the output

The first sorted range is #(1 3). Because the output is empty, it becomes the active range. There is nothing to compare it with yet.

NATIVE SQUEAK CAPTURE
Native interval-union view, step 1: First range opens the output
Actual Squeak Morphic rendering of sorted inputs and the accumulated union at step 1.

2 · An overlap extends the end

The range #(2 4) starts before the active end 3. Retain the start 1 and extend the end to max(3, 4), producing #(1 4).

NATIVE SQUEAK CAPTURE
Native interval-union view, step 2: An overlap extends the end
Actual Squeak Morphic rendering of sorted inputs and the accumulated union at step 2.

3 · A second overlap extends the same range

The range #(2 6) overlaps the active output. Its end is larger, so the active range becomes #(1 6).

NATIVE SQUEAK CAPTURE
Native interval-union view, step 3: A second overlap extends the same range
Actual Squeak Morphic rendering of sorted inputs and the accumulated union at step 3.

4 · A positive gap starts a new range

The next start 9 is greater than the active end 6. The range #(1 6) is complete; append #(9 12) as the new active range.

NATIVE SQUEAK CAPTURE
Native interval-union view, step 4: A positive gap starts a new range
Actual Squeak Morphic rendering of sorted inputs and the accumulated union at step 4.

5 · Touching endpoints join

The range #(12 14) starts exactly at the active end 12. Closed ranges share that endpoint, so merge them into #(9 14).

NATIVE SQUEAK CAPTURE
Native interval-union view, step 5: Touching endpoints join
Actual Squeak Morphic rendering of sorted inputs and the accumulated union at step 5.

6 · The last gap completes the union

The last start 15 is greater than 14. Append #(15 17). The final output is #(#(1 6) #(9 14) #(15 17)); each output range has a positive gap before the next.

NATIVE SQUEAK CAPTURE
Native interval-union view, step 6: The last gap completes the union
Actual Squeak Morphic rendering of sorted inputs and the accumulated union at step 6.
NATIVE SQUEAK CAPTURE
Interval-union visualizer at the first of six sorted-scan states
Six genuine native Squeak Morphic captures, replayed in algorithm order. This is a sequence of captured states, not a mouse recording.

07 · Check empty, nested, duplicate, and chain cases

An empty input naturally produces an empty output. Contained and duplicate ranges must not create extra output. A chain can connect two ranges that did not overlap before the middle range arrived.

Run: Workspace → select the complete expression → Print It.

Independent Workspace expression · select all, then Print it
| merge |
merge := [:inputRanges |
    | sortedRanges mergedRanges |
    sortedRanges := inputRanges asSortedCollection: [:earlierRange :laterRange |
        earlierRange first < laterRange first or: [
            earlierRange first = laterRange first and: [earlierRange second <= laterRange second]]].
    mergedRanges := OrderedCollection new.
    sortedRanges do: [:candidateRange |
        (mergedRanges isEmpty or: [candidateRange first > mergedRanges last second])
            ifTrue: [mergedRanges add: {candidateRange first. candidateRange second}]
            ifFalse: [mergedRanges last at: 2
                put: (mergedRanges last second max: candidateRange second)]].
    mergedRanges asArray].
{merge value: #().
 merge value: #((1 9) (3 5) (1 9)).
 merge value: #((6 8) (1 3) (3 6)).
 merge value: #((-4 -1) (0 0) (2 2))}

Expected result (verified in Squeak 6.1):

Expected answer · compare, do not paste
#(#() #(#(1 9)) #(#(1 8)) #(#(-4 -1) #(0 0) #(2 2)))

The chain #(1 3), #(3 6), #(6 8) becomes one closed range #(1 8). The separate point ranges in the last case remain separate: this algorithm does not fill gaps just because endpoints are integers.

08 · Validate before sorting

The public boundary below accepts an outer Array containing only two-element Arrays of Integer endpoints with start <= end. Validate before sorting so malformed records cause a deliberate error rather than a cryptic comparison failure. The narrower contract avoids floating-point NaN, mixed units, and incompatible endpoint types.

Run: Workspace → select the complete expression → Print It.

Independent Workspace expression · select all, then Print it
| merge invalid rejected |
merge := [:inputRanges |
    | sortedRanges mergedRanges |
    (inputRanges isKindOf: Array)
        ifFalse: [Error signal: 'Use an Array of two-integer ranges'].
    inputRanges do: [:candidateRange |
        ((candidateRange isKindOf: Array) and: [candidateRange size = 2 and: [
            candidateRange first isInteger and: [candidateRange second isInteger and: [
                candidateRange first <= candidateRange second]]]])
            ifFalse: [Error signal: 'Use ordered two-integer ranges']].
    sortedRanges := inputRanges asSortedCollection: [:earlierRange :laterRange |
        earlierRange first < laterRange first or: [
            earlierRange first = laterRange first and: [earlierRange second <= laterRange second]]].
    mergedRanges := OrderedCollection new.
    sortedRanges do: [:candidateRange |
        (mergedRanges isEmpty or: [candidateRange first > mergedRanges last second])
            ifTrue: [mergedRanges add: {candidateRange first. candidateRange second}]
            ifFalse: [mergedRanges last at: 2
                put: (mergedRanges last second max: candidateRange second)]].
    mergedRanges asArray].
invalid := #((#(5 2)) (#(1)) (#(1 2 3)) (#(1 2.5)) (#('a' 3))).
rejected := invalid collect: [:candidate |
    [merge value: candidate. false]
        on: Error
        do: [:error | error messageText = 'Use ordered two-integer ranges']].
{merge value: #((-4 -1) (-1 3) (8 8)). rejected}

Expected result (verified in Squeak 6.1):

Expected answer · compare, do not paste
#(#(#(-4 3) #(8 8)) #(true true true true true))

Negative coordinates and a zero-length range are valid. Reversed endpoints are rejected rather than silently swapped. The lesson’s compact checkpoints assume valid inputs; use this guarded block at an untrusted-input boundary.

09 · Verify that merging does not edit the input

A shallow copy of the outer Array would not protect its nested pairs. This implementation avoids that trap by constructing new pairs whenever it appends to the result. Compare both the source values and object identity after merging.

Run: Workspace → select the complete expression → Print It.

Independent Workspace expression · select all, then Print it
| merge ranges result |
merge := [:inputRanges |
    | sortedRanges mergedRanges |
    sortedRanges := inputRanges asSortedCollection: [:earlierRange :laterRange |
        earlierRange first < laterRange first or: [
            earlierRange first = laterRange first and: [earlierRange second <= laterRange second]]].
    mergedRanges := OrderedCollection new.
    sortedRanges do: [:candidateRange |
        (mergedRanges isEmpty or: [candidateRange first > mergedRanges last second])
            ifTrue: [mergedRanges add: {candidateRange first. candidateRange second}]
            ifFalse: [mergedRanges last at: 2
                put: (mergedRanges last second max: candidateRange second)]].
    mergedRanges asArray].
ranges := { {1. 3}. {2. 7} }.
result := merge value: ranges.
{ranges. result. ranges = #((1 3) (2 7)).
 result first == ranges first}

Expected result (verified in Squeak 6.1):

Expected answer · compare, do not paste
#(#(#(1 3) #(2 7)) #(#(1 7)) true false)

Value equality (=) confirms the input still has its original endpoints. Identity (==) confirms the output pair is not the first source pair. This matters when callers reuse input records elsewhere.

10 · Check coverage, separation, and idempotence

Test three independent properties: the input and output cover the same sampled coordinates; successive output ranges have a strict gap; and merging an already merged result changes nothing. With integer endpoints, sampling every integer and midpoint in the enclosing region checks every possible boundary and between-boundary coverage pattern for this dataset.

Run: Workspace → select the complete expression → Print It.

Independent Workspace expression · select all, then Print it
| merge ranges result coverageMatches separated checked point inputHas outputHas |
merge := [:inputRanges |
    | sortedRanges mergedRanges |
    sortedRanges := inputRanges asSortedCollection: [:earlierRange :laterRange |
        earlierRange first < laterRange first or: [
            earlierRange first = laterRange first and: [earlierRange second <= laterRange second]]].
    mergedRanges := OrderedCollection new.
    sortedRanges do: [:candidateRange |
        (mergedRanges isEmpty or: [candidateRange first > mergedRanges last second])
            ifTrue: [mergedRanges add: {candidateRange first. candidateRange second}]
            ifFalse: [mergedRanges last at: 2
                put: (mergedRanges last second max: candidateRange second)]].
    mergedRanges asArray].
ranges := #((9 12) (1 3) (2 6) (15 17) (12 14) (2 4)).
result := merge value: ranges.
coverageMatches := true.
checked := 0.
0 to: 36 do: [:twice |
    point := twice / 2.
    inputHas := ranges anySatisfy: [:range |
        range first <= point and: [point <= range second]].
    outputHas := result anySatisfy: [:range |
        range first <= point and: [point <= range second]].
    coverageMatches := coverageMatches and: [inputHas = outputHas].
    checked := checked + 1].
separated := true.
2 to: result size do: [:index |
    separated := separated and: [
        (result at: index - 1) second < (result at: index) first]].
{checked. coverageMatches. separated. (merge value: result) = result}

Expected result (verified in Squeak 6.1):

Expected answer · compare, do not paste
#(37 true true true)

These 37 probes run from 0 through 18 in half-unit steps and surround all endpoints in this input. An integer-only coverage check would miss a gap between, for example, two distinct point ranges. This is a dataset-specific check, not randomized testing or a proof over all possible inputs.

11 · Exercise: measure coverage without double counting

Find the total length of the union, not the sum of the original lengths. Merge first, then add end - start for the non-overlapping output ranges. A point range has length zero. Do not add 1 unless the intended quantity is a count of integer positions rather than length.

Run: Workspace → select the complete expression → Print It.

Independent Workspace expression · select all, then Print it
| merge result length integerPoints |
merge := [:inputRanges |
    | sortedRanges mergedRanges |
    sortedRanges := inputRanges asSortedCollection: [:earlierRange :laterRange |
        earlierRange first < laterRange first or: [
            earlierRange first = laterRange first and: [earlierRange second <= laterRange second]]].
    mergedRanges := OrderedCollection new.
    sortedRanges do: [:candidateRange |
        (mergedRanges isEmpty or: [candidateRange first > mergedRanges last second])
            ifTrue: [mergedRanges add: {candidateRange first. candidateRange second}]
            ifFalse: [mergedRanges last at: 2
                put: (mergedRanges last second max: candidateRange second)]].
    mergedRanges asArray].
result := merge value: #((9 12) (1 3) (2 6) (15 17) (12 14) (2 4)).
length := result inject: 0 into: [:total :range |
    total + (range second - range first)].
integerPoints := result inject: 0 into: [:total :range |
    total + (range second - range first + 1)].
{length. integerPoints}

Expected result (verified in Squeak 6.1):

Expected answer · compare, do not paste
#(12 15)

The three lengths are 5, 5, and 2. The numbers of integer positions are 6, 6, and 3. Both answers are correct for their own question; confusing them is an endpoint-convention bug.

12 · Exercise: clip the union to a window

Keep only the portions covered inside the closed window #(2 13). First merge, then intersect each result with the window. A clipped pair is kept when its new start is no later than its new end, so a single surviving endpoint is retained.

Run: Workspace → select the complete expression → Print It.

Independent Workspace expression · select all, then Print it
| merge result window clipped low high |
merge := [:inputRanges |
    | sortedRanges mergedRanges |
    sortedRanges := inputRanges asSortedCollection: [:earlierRange :laterRange |
        earlierRange first < laterRange first or: [
            earlierRange first = laterRange first and: [earlierRange second <= laterRange second]]].
    mergedRanges := OrderedCollection new.
    sortedRanges do: [:candidateRange |
        (mergedRanges isEmpty or: [candidateRange first > mergedRanges last second])
            ifTrue: [mergedRanges add: {candidateRange first. candidateRange second}]
            ifFalse: [mergedRanges last at: 2
                put: (mergedRanges last second max: candidateRange second)]].
    mergedRanges asArray].
result := merge value: #((9 12) (1 3) (2 6) (15 17) (12 14) (2 4)).
window := #(2 13).
clipped := OrderedCollection new.
result do: [:range |
    low := range first max: window first.
    high := range second min: window second.
    low <= high ifTrue: [clipped add: {low. high}]].
clipped asArray

Expected result (verified in Squeak 6.1):

Expected answer · compare, do not paste
#(#(2 6) #(9 13))

Clipping cannot create new overlaps among these already-separated ranges, so another sort or merge is unnecessary. For a production API, validate the window with the same endpoint contract.

13 · Exercise: find uncovered integer positions

Within the inclusive integer window 0 through 18, return positions not covered by any merged range. This is an enumeration exercise, not a representation of the continuous complement; a real-number gap has open boundaries that a closed pair alone cannot express.

Run: Workspace → select the complete expression → Print It.

Independent Workspace expression · select all, then Print it
| merge result missing |
merge := [:inputRanges |
    | sortedRanges mergedRanges |
    sortedRanges := inputRanges asSortedCollection: [:earlierRange :laterRange |
        earlierRange first < laterRange first or: [
            earlierRange first = laterRange first and: [earlierRange second <= laterRange second]]].
    mergedRanges := OrderedCollection new.
    sortedRanges do: [:candidateRange |
        (mergedRanges isEmpty or: [candidateRange first > mergedRanges last second])
            ifTrue: [mergedRanges add: {candidateRange first. candidateRange second}]
            ifFalse: [mergedRanges last at: 2
                put: (mergedRanges last second max: candidateRange second)]].
    mergedRanges asArray].
result := merge value: #((9 12) (1 3) (2 6) (15 17) (12 14) (2 4)).
missing := OrderedCollection new.
0 to: 18 do: [:point |
    (result anySatisfy: [:range |
        range first <= point and: [point <= range second]])
        ifFalse: [missing add: point]].
missing asArray

Expected result (verified in Squeak 6.1):

Expected answer · compare, do not paste
#(0 7 8 18)

Enumeration is useful only for a bounded, reasonably small integer window. For huge coordinates or continuous gaps, return a suitable range representation with explicit open/closed endpoints rather than inspecting every point.

Cost and limitations

After sorting, the merge pass visits each range once and appends at most n fresh pairs. It uses O(n) output storage. With an O(n log n) comparison sort, sorting dominates the overall algorithm; the code delegates sorting to Squeak’s collection implementation rather than implementing or benchmarking a sort here. Validation is an additional O(n) pass. The trace is intentionally more expensive because it copies the evolving result after every step.

This computes union coverage. It does not count simultaneous overlaps, select the maximum number of compatible appointments, preserve each source range’s labels, or return the original ranges. Extend the representation deliberately if any of those facts matter. For half-open time slots, decide separately whether touching slots should remain distinct for conflict reporting or be coalesced for coverage. For integer adjacency, merging #(1 3) with #(4 7) would be another policy; this lesson does not do so because it models the real-number line between integer endpoints.

Verification and next steps

On 25 October 2026, all 13 displayed expressions and their exact expected answers were executed in a fresh private copy of native Squeak 6.1 build 23976. The complete bundle answered 13. Checkpoint 10 also compares input and output membership at 37 half-integer sample positions and checks separation and idempotence. These checks support the worked example; they are not a proof for every possible input.

The four Workspace screenshots and six visual states were captured from the actual native Morphic objects with imageForm. The visual source was executed at every stage from 1 to 6. Read the execution log or use the reproduction script with your own Squeak VM and image paths. The script uses a private image copy and writes its own screenshots and reports; it does not save the original image.

Try changing the data, predict the merged result first, then add a check before running the scan. Continue with SUnit testing, Rectangle boundaries, or collection transformations. For the environment and language manuals, see official Squeak documentation.