Implement generic @truncate macro

Speed up DiscreteDistributionTable
Switch integer_valued => isinteger
Switch real_valued => isreal