Timeline for Compute the Digit Difference Sum of a Number
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 17, 2020 at 9:04 | history | edited | CommunityBot |
Commonmark migration
|
|
Sep 20, 2015 at 21:25 | comment | added | Leif Willerts | disappointing, but good to know! | |
Sep 20, 2015 at 20:27 | comment | added | nimi |
chr and ord are both in Data.Char , so you can't omit the import . Compiler flags are counted as bytes, too, so NoMonomorphismRestriction increases your score by 25.
|
|
Sep 20, 2015 at 18:22 | comment | added | Leif Willerts |
Isn't chr.(+48) even shorter than toEnum.(+48) , and (\i->ord i-48) than (\i->fromEnum i-48) ?
|
|
Sep 20, 2015 at 18:20 | comment | added | Leif Willerts |
Brilliant! Also, is it common procedure here to use GHC extensions? NoMonomorphismRestriction will let me have d pointfree, too.
|
|
Sep 20, 2015 at 16:34 | comment | added | nimi |
... it's me again to correct a mistake in my first comment: =<< is used in function context, not list context, sorry.
|
|
Sep 20, 2015 at 16:08 | comment | added | nimi |
... oh, and if s is pointfree, there's not need to give it a name. Call it directly: iterate(snd.span ... tail))
|
|
Sep 20, 2015 at 16:01 | comment | added | nimi |
intToDigit is toEnum.(+48) and digitToInt is (\i->fromEnum i-48) . You can also turn s to a pointfree version with =<< in list context: s=snd.span(==0).m abs.(zipWith(-)=<<tail) . Finally, (==0) is (<1) , because we're working with non-negative integers.
|
|
Sep 20, 2015 at 11:46 | history | answered | Leif Willerts | CC BY-SA 3.0 |