www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - do we already have sum-modulo-10 algo (aka Luhn's algo) on phobos ?

reply someone <someone somewhere.com> writes:
https://en.wikipedia.org/wiki/Luhn_algorithm#Pseudocode_implementation
Jul 03 2021
parent jfondren <julian.fondren gmail.com> writes:
On Saturday, 3 July 2021 at 17:44:48 UTC, someone wrote:
 https://en.wikipedia.org/wiki/Luhn_algorithm#Pseudocode_implementation
That specific function, in Phobos? no. sum modulo 10? That's just some_var%10 in D. The Wikipedia link ends with a link to RosettaCode: https://rosettacode.org/wiki/Luhn_test_of_credit_card_numbers#D ... this is a pretty nice RC entry, translating Haskell, C, and SPARK all into D. Really shows off D's range of expression.
Jul 03 2021