Catamorphism: Difference between revisions

m
Line 652:
# leaves the nesting depth unchanged for any other character
# updates the accumulator no further if the nesting depth ever becomes negative.
 
 
or for a simple bracket count, we could just define a:
 
'''bracketCount(accumulator)(character)''' which:
 
# Increments the integer accumulator value on each "[" or "]"
# Leaves the accumulator unchanged for other characters.
 
 
9,655

edits