How to validate credit card numbers (Solving Luhn on Exercism)

Опубликовано: 13 Август 2026
на канале: Exercism
4,178
73

In this video, we explore 9 different ways to solve the Lunn exercise on Exercism. We explore guards, method chains, vectorised operations, and a fun SQLite solution!

We look at a variety of different languages including Swift, C++, Ruby, Gleam, R, Pharo, Tcl, Raku and SQLite.

Kick back and enjoy an hour of learning with Jeremy and Erik, then go solve the exercise in your favourite way on Exercism.

Solve the exercise at: https://exercism.org/exercises/luhn
Join #48in24 at: https://exercism.org/challenges/48in24


Featured Solutions:
https://exercism.org/tracks/ruby/exer...
https://exercism.org/tracks/swift/exe...
https://exercism.org/tracks/cpp/exerc...
https://exercism.org/tracks/gleam/exe...
https://exercism.org/tracks/r/exercis...
https://exercism.org/tracks/pharo-sma...
https://exercism.org/tracks/tcl/exerc...
https://exercism.org/tracks/raku/exer...
https://exercism.org/tracks/sqlite/ex...

Timestamps:
00:00:00 Introduction
00:02:22 Ruby: method chain with indexed map
00:04:49 C++: reverse iteration in single pass
00:09:52 Swift: reverse iteration and flag for even/odd
00:13:16 Gleam: functional method chain with Result type
00:21:09 R: vectorized operation to only update even indices
00:25:25 Pharo: sanitize replace even characters
00:31:21 Tcl: index into list for doubling
00:34:18 Raku: multi-method and sum doubled digits
00:38:56 SQlite: multiply by special value for doubling
00:56:01 Conclusion