Prototype: Prototype(readers []ValueReader) ([]int,error) calls ReadValue in input order, returning values on complete success. Nil interface or source error returns nil and nonnil error, without calling later readers; preserve errors.Is identity. Empty input returns nonnil empty. Typed nil implementations are allowed to define their own ReadValue behavior.

Final: Solve(readers []ValueReader) ([]int,error) has the same aggregation contract. Also implement (*ScaledReader).ReadValue() (int,error) using its exported Source and Factor fields: nil Source interface errors; otherwise call once, propagate error unchanged/classifiably, or return value*Factor. Factor may be zero/negative and products fit int. Wrappers compose recursively and must satisfy ValueReader. Reading may have external side effects; fail-fast does not undo earlier reads. Do not mutate supplied reader slice or replace its elements.

Edit exercise.go; retain the public types and signatures. prototype and final are separate stages. The executable tests recover panics as failures, report named checks, and exit nonzero on any failure. A successful run must execute at least one check. Tests use logical time or explicit synchronization where relevant.

Drag or use the arrow keys to resize. Home collapses the question; End collapses the editor. Enter or double-click resets the split.
Loading editor…
No results yet.

Complete the starter code, then run the checks.
Results and errors will appear here.