docs: def make_program(self,stack,func_set,term_set,max_d,ntype):
          """makes a program stack"""
          # print("stack:",stack,"max d:",max_d)
          if max_d == 0:
              ts = [t for t in term_set if t.out_type==ntype]
  
              if not ts:
                  raise ValueError('no ts. ntype:'+ntype+'. term_set out_types:'+
                                   ','.join([t.out_type for t in term_set]))
  
              stack.append(ts[self.random_state.choice(len(ts))])
          else:
              fs = [f for f in func_set if (f.out_type==ntype
                                            and (f.in_type=='f' or max_d>1))]
              if len(fs)==0:
                  print('ntype:',ntype,'\nfunc_set:',[f.name for f in func_set])
              stack.append(fs[self.random_state.choice(len(fs))])
              tmp = copy.copy(stack[-1])
  
              for i in np.arange(tmp.arity['f']):
                  self.make_program(stack,func_set,term_set,max_d-1,'f')
              for i in np.arange(tmp.arity['b']):
                  self.make_program(stack,func_set,term_set,max_d-1,'b')