work in progress | string |
occurrences (c: CHARACTER): INTEGER -- Number of times c appears in the string ensure zero_if_empty: count = 0 implies Result = 0 simple_recurse: (count > 0 and then item (1) /= c) implies Result = substring (2, count).occurrences (c) recurse_and_add: (count > 0 and then item (1) = c) implies Result = 1 + substring (2, count).occurrences (c)
Votes cast at egroups:
Strongly accept the proposal
franck.arnaud@omgroup.com
Accept the proposal
sergei_ivanov@object-tools.com
jcm@mstr.hgc.edu
ericb@gobosoft.com
genepi@sympatico.ca
saunders@wchat.on.ca
kwaxer@aha.ru
Don't mind (happy either way)
tking@insystems.com
Reject the proposal
joachim.durchholz@halstenbach.de
Rename the postconditions, yielding the following set:
zero_if_empty: count = 0 implies Result = 0 recurse_if_not_found_at_first_position: (count > 0 and then item (1) /= c) implies Result = substring (2, count).occurrences (c) recurse_if_found_at_first_position: (count > 0 and then item (1) = c) implies Result = 1 + substring (2, count).occurrences (c)This proposed amendment was unopposed, and has been incorporated into the ELKS 2000 draft without a formal vote.