| as yet unclassified |
| allValues: aBlock
|
|kPrev results|
kPrev _ failureContinuation.
results _ OrderedCollection new.
(Continuation currentDo:
[:kRetry |
failureContinuation _ [:v | kRetry value: false].
results add: aBlock value.
kRetry value: true])
ifTrue: [self fail].
failureContinuation _ kPrev.
^ results asArray
|
| assert: aBoolean
|
aBoolean ifFalse: [self fail]
|
| deny: aBoolean
|
self assert: aBoolean not
|
| fail
|
^ failureContinuation value: nil
|
| initialize
|
failureContinuation _ [:v | self error: 'Amb tree exhausted'].
|
| maybe
|
^ self oneOf: (Array with: true with: false)
|
| oneOf: aCollection
|
^ self valueOfOneOf: (aCollection collect: [:ea | [ea] fixTemps])
|
| valueOf: blockOne or: blockTwo
|
^ self valueOfOneOf: (Array with: blockOne with: blockTwo)
|
| valueOf: blockOne or: blockTwo or: blockThree
|
^ self valueOfOneOf: (Array with: blockOne with: blockTwo with: blockThree)
|
| valueOfOneOf: blockCollection
|
|kPrev|
kPrev _ failureContinuation.
^ Continuation currentDo:
[:kEntry |
blockCollection do:
[:ea |
Continuation currentDo:
[:kNext |
failureContinuation _
[:v | failureContinuation _ kPrev. kNext value: v] fixTemps.
kEntry value: ea value]].
kPrev value: nil]
|