Created
October 31, 2021 22:36
-
-
Save Sciss/195e1992358fc6bf9a77f031b2a69e2a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val s = "978-3-9504622-3-" | |
val s0 = s.filter(_.isDigit) | |
val u = (s0 zip Iterator.continually(Seq(1, 3)).flatten).map { case (c, m) => c.toString.toInt * m } .sum | |
val v = u.roundUpTo(10) | |
val p = v - u // 4 | |
s ++ p.toString // "978-3-9504622-3-4" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment