reimplemented binding-set

use when and reduce rather than manual recursion