Relational algebra and functional programming