;; count-outliers-loop.sal -- using a while loop to count things ;; (c) 2008 by Roger B. Dannenberg define function count-outliers-loop( midi-note-list) begin with element, result = 0 loop while midi-note-list set element = first(midi-note-list) if element < 0 | element > 127 then set result += 1 set midi-note-list = rest(midi-note-list) end return result end print count-outliers-loop({189 -5 129 78 64})