Re:Using Monads in C++ to Solve Constraints: 1. The List Monad
by im3w1l on Tuesday May 12, 2015 @09:43PM
(#9536229)
Sure. But it isn't clear to me it should work with zero length input. Not working is consistent with the builtin int, int("") throws an exception.
Re:Using Monads in C++ to Solve Constraints: 1. The List Monad
by TheLoneWolfling on Wednesday May 13, 2015 @01:07AM
(#9536860)
It's straight from the definition of an integer. An integer is defined as sum(i=0 to n) d_n * base^n. A number with zero digits is just the empty sum, which is canonically defined to be zero.
I'll also note that int() returns 0.
That being said, that's much cleaner. Thanks!