how to build a deck gate from composite functions