digitToInt, tails functions