'From Cuis 2.4 of 17 June 2010 [latest update: #509] on 19 July 2010 at 9:22:24 am'!

!Collection methodsFor: 'enumerating' stamp: 'eem 1/11/2009 14:11'!
fold: binaryBlock
	"Evaluate the block with the first two elements of the receiver,
	 then with the result of the first evaluation and the next element,
	 and so on.  Answer the result of the final evaluation. If the receiver
	 is empty, raise an error. If the receiver has a single element, answer
	 that element."
	"#('if' 'it' 'is' 'to' 'be' 'it' 'is' 'up' 'to' 'me') fold: [:a :b | a, ' ', b]"

	| firstValue nextValue |
	firstValue := nextValue := Object new. "something that can't be in the receiver"
	self do:
		[:each |
		nextValue := firstValue == nextValue
						ifTrue: [each]
						ifFalse: [binaryBlock value: nextValue value: each]].
	^nextValue == firstValue
		ifTrue: [self errorEmptyCollection]
		ifFalse: [nextValue]! !


!SequenceableCollection methodsFor: 'copying' stamp: 'eem 2/10/2009 11:44'!
copyUpThrough: anElement 
	"Answer all elements up to and including anObject. If there
	is no such object, answer a copy of the receiver."

	^self first: (self indexOf: anElement ifAbsent: [^ self copy])! !


!SystemDictionary methodsFor: 'system attributes' stamp: 'eem 7/6/2010 20:43'!
isRunningCog
	"Returns true if we're running on a Cog VM (JIT or StackInterpreter)
	 (vmParameterAt: 42 is the number of stack pages)"

	^[(self vmParameterAt: 42) > 0] on: Error do:[:ex| ex return: false]! !

!SystemDictionary methodsFor: 'system attributes' stamp: 'eem 7/6/2010 20:41'!
isRunningCogit
	"Returns true if we're running on the Cog JIT
	 (vmParameterAt: 46 is the size of the machine code zone)"

	^[(self vmParameterAt: 46) > 0] on: Error do:[:ex| ex return: false]! !

SmallInteger removeSelector: #printStringBase:!
SmallInteger removeSelector: #printStringBase:nDigits:!
LargePositiveInteger removeSelector: #printStringBase:!
