Topic: foreach and for all statements
Topic: sequence generators
Topic: set operations
| |
Summary
Repetition can be used for selection, if it is first quantified by a selection criterion. The mathematical parallel is existential quantification. Quantified repetition can search a sequence for a matching component (e.g., 'the first X in S such that X_has_attribute'), can analyze a sequence (e.g., 'if 2 components of sequence S have Attribute'), can test for membership (e.g., 'if any component of S has Attribute then...), can verify a sequence (e.g.,'assert all components of S have Attribute'), or can test a sequence (e.g., 'if one and only one X in S has Attribute then...'). (cbb 5/80)
Subtopic: quantifiers in programs
Quote: FEA formulas may have universal quantifiers, existential quantifiers, or one-and-only-one quantifiers [»postSW7_1978]
| Quote: an Icon generator tries alternatives until the entire statement succeeds; gives example [»grisRE4_1979, OK]
| QuoteRef: baueFL7_1972 ;;682 existence and for all operations eg .mu.x (x.inSet.V.and.r(x)) is next x such that x is in the slice of V and r(x) is true if no x found then statement is done
| QuoteRef: buxtJN_1962 ;;195 tests: all (all members satisfy test chain), exists (any members) unique (el) (el members satisfy test chain) default chain is true eg ALL i seta 11 &120< test chain
| QuoteRef: buxtJN_1962 ;;195 searches using test chains: get max (exp) min (exp), first, last, any. e.g., FIND I seta MIN (exp) 11 & 12 .newLine. testchain-on-i
| QuoteRef: knowK8_1966 ;;618 have if-any if-none in-all if-not-all
| QuoteRef: morrJH8_1972 ;;758 for all and there exists predicates returning true or false
| Subtopic: examples
Quote: a common use of loops is to search a sequence for the first element that passes a test; needs an exit or goto statement [»shawM8_1976]
| QuoteRef: shawM8_1976 ;;8 Alphard: 'first x: gen (y) 'suchthat predicate (x) 'then statement 'else statement
| QuoteRef: sammJE_1969 ;;226 first i=1(1)10: i>4 =5 (first value satisfying condition
| QuoteRef: simscrip_1971 ;;118 Find clause after for loop returns first satisfying index, can specify action if found or not otherwise falls through
|
Related Topics
Topic: foreach and for all statements (16 items)
Topic: sequence generators (16 items)
Topic: set operations (12 items)
|