functional set implementation