def coalesce(bits):
	"""
	Take a sequence of bits, most significant first, and
	coalesce them into a number.

	>>> coalesce([1,0,1])
	5
	"""
	def operation(a, b):
		return a << 1 | b
	return reduce(operation, bits)