A parallel functional implementation of range queries