Long-term electrocardiograms exhibit a small number of QRS morphologies (waveform shapes) whose analysis can reveal cardiac abnormalities. We considered the problem of accurately identifying instances of each in 24-h ECG recordings. A new learning algorithm was developed. Each QRS morphology is represented as a tree of rule activations, which associate attribute measurements with a rule. Each rule has a syntactic pattern together with a semantic procedure which manages and applies the knowledge stored in the activation. A single rule may be activated several times to learn different waveform segments. Delineation refinement improves each hypothesized signal interpretation. A simple conflict resolution mechanism resolves conflicting interpretations into a single unambiguous one. Comparison of the system with an existing program confirmed the promise of the new approach.