<commit_before>
Queue: class <T> {
	_backend: T*
	_capacity := 0
	_count := 0
	_head := 0
	_tail := 0
	capacity ::= this _capacity
	count ::= this _count
	empty ::= this _count == 0
	full ::= this _count == this _capacity
	_chunkCount := 32

	init: func (capacity := 32) {
		this _capacity = capacity
		this _backend = gc_calloc(capacity as SizeT, T size)
	}
	free: override func {
		gc_free(_backend)
		super()
	}
	clear: func {
		this _head = 0
		this _tail = 0
		this _count = 0
	}
	enqueue: virtual func (item: T) {
		if (this full)
			this _resize()
		this _backend[this _tail] = item
		this _tail = (this _tail + 1) % this _capacity
		this _count += 1
	}
	dequeue: virtual func -> (T, Bool) {
		if (!this empty) {
			tempHead := this _head
			if (this _head != this _tail || this full)
				this _head = (this _head + 1) % this _capacity
			this _count -= 1
			return this _backend[tempHead]
		} else
			raise("Trying to dequeue something from an empty queue")
	}
	_resize: func {
		oldCapacity := this _capacity
		newCapacity := this _capacity + this _chunkCount
		moveCount := oldCapacity - this _head
		bytes := newCapacity * T size
		this _backend = gc_realloc(this _backend, bytes)
		sourcePtr: UInt8* = this _backend as UInt8* + (this _head * T size)
		destinationPtr := sourcePtr + (this _chunkCount * T size)
		memmove(destinationPtr, sourcePtr, moveCount * T size)
		this _head += this _chunkCount
		this _capacity = newCapacity
	}
	peek: virtual func -> T {
		if (!this empty)
			return this _backend[this _head]
		else
			raise("Trying to peek on an empty queue")
	}
	toString: func -> String {
		result := ""
		result += "Count: %d \n" format(this _count)
		result += "Capacity: %d \n" format(this _capacity)
		/*for (i in 0..this _count) {
			index := (i + this _head) % this _capacity
			result += ("Value %d = " format(i))
			value := this _backend[index]
			temp: Int = 0
			temp += (value as Int)
			result += temp toString() + "\n"
		}*/
		result
	}
}
<commit_msg>Changed return type of dequeue.<commit_after>
Queue: class <T> {
	_backend: T*
	_capacity := 0
	_count := 0
	_head := 0
	_tail := 0
	capacity ::= this _capacity
	count ::= this _count
	empty ::= this _count == 0
	full ::= this _count == this _capacity
	_chunkCount := 32

	init: func (capacity := 32) {
		this _capacity = capacity
		this _backend = gc_calloc(capacity as SizeT, T size)
	}
	free: override func {
		gc_free(_backend)
		super()
	}
	clear: func {
		this _head = 0
		this _tail = 0
		this _count = 0
	}
	enqueue: virtual func (item: T) {
		if (this full)
			this _resize()
		this _backend[this _tail] = item
		this _tail = (this _tail + 1) % this _capacity
		this _count += 1
	}
	dequeue: virtual func -> T {
		if (!this empty) {
			tempHead := this _head
			if (this _head != this _tail || this full)
				this _head = (this _head + 1) % this _capacity
			this _count -= 1
			return this _backend[tempHead]
		} else
			raise("Trying to dequeue something from an empty queue")
	}
	_resize: func {
		oldCapacity := this _capacity
		newCapacity := this _capacity + this _chunkCount
		moveCount := oldCapacity - this _head
		bytes := newCapacity * T size
		this _backend = gc_realloc(this _backend, bytes)
		sourcePtr: UInt8* = this _backend as UInt8* + (this _head * T size)
		destinationPtr := sourcePtr + (this _chunkCount * T size)
		memmove(destinationPtr, sourcePtr, moveCount * T size)
		this _head += this _chunkCount
		this _capacity = newCapacity
	}
	peek: virtual func -> T {
		if (!this empty)
			return this _backend[this _head]
		else
			raise("Trying to peek on an empty queue")
	}
	toString: func -> String {
		result := ""
		result += "Count: %d \n" format(this _count)
		result += "Capacity: %d \n" format(this _capacity)
		/*for (i in 0..this _count) {
			index := (i + this _head) % this _capacity
			result += ("Value %d = " format(i))
			value := this _backend[index]
			temp: Int = 0
			temp += (value as Int)
			result += temp toString() + "\n"
		}*/
		result
	}
}

{'fraction_non_alphanumeric': 0.11997991967871485, 'fraction_numerical': 0.010040160642570281, 'mean_word_length': 3.1815320041972717, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1656820', 'n_tokens_mistral': 1543, 'n_tokens_neox': 1379, 'n_words': 485}