TIL: The exercise teaches loops, but reduce(0, +) and array slicing solved it without a single for.
#Swift #Exercism #buildinpublic
TIL: The exercise teaches loops, but reduce(0, +) and array slicing solved it without a single for.
#Swift #Exercism #buildinpublic
In more ways than one
In more ways than one
Concept: Optionals
A switch over a tuple of optionals makes every nil case explicit, and guard let diameter, let slices validates the input in one line.
#Swift #Exercism #buildinpublic
Concept: Optionals
A switch over a tuple of optionals makes every nil case explicit, and guard let diameter, let slices validates the input in one line.
#Swift #Exercism #buildinpublic
#MyElixirStatus
#MyElixirStatus
Concept: Ranges
Ranges aren't just numbers: "A"..."H" is a valid ClosedRange
#Swift #Exercism #buildinpublic
Concept: Ranges
Ranges aren't just numbers: "A"..."H" is a valid ClosedRange
#Swift #Exercism #buildinpublic
youtu.be/6tJMP5UobqU
youtu.be/6tJMP5UobqU
TIL: switch is an expression in modern Swift, and patterns like 2...3 or 4, 6 match license types in one statement.
#Swift #Exercism #buildinpublic
TIL: switch is an expression in modern Swift, and patterns like 2...3 or 4, 6 match license types in one statement.
#Swift #Exercism #buildinpublic
TIL: Returning a closure lets protectSecret capture the secret and the password, so the check lives inside the function it hands back.
#Swift #Exercism #buildinpublic
TIL: Returning a closure lets protectSecret capture the secret and the password, so the check lives inside the function it hands back.
#Swift #Exercism #buildinpublic
TIL: Parameters are immutable, so var stack = stack makes a local copy to mutate. A guard blocks out-of-range indexes.
#Swift #Exercism #buildinpublic
TIL: Parameters are immutable, so var stack = stack makes a local copy to mutate. A guard blocks out-of-range indexes.
#Swift #Exercism #buildinpublic
Concept: Numbers and type conversion
Swift never turns an Int into a Double for you. You convert explicitly, and .rounded(.down) picks the rounding rule.
#Swift #Exercism #buildinpublic
Concept: Numbers and type conversion
Swift never turns an Int into a Double for you. You convert explicitly, and .rounded(.down) picks the rounding rule.
#Swift #Exercism #buildinpublic
exercism.org/tracks/elixi...
#MyElixirStatus
exercism.org/tracks/elixi...
#MyElixirStatus
The hard part: Updating one tuple in an immutable array without a loop: firstIndex, a guard let, then a local var copy.
#Swift #Exercism #buildinpublic
The hard part: Updating one tuple in an immutable array without a loop: firstIndex, a guard let, then a local var copy.
#Swift #Exercism #buildinpublic
I have to say, this became very aesthetically pleasing!
I have to say, this became very aesthetically pleasing!
o game of life ainda tá bem capenga, porque tentei fazer o máximo funcional e otimizado possível, ainda tem teste quebrado.
o game of life ainda tá bem capenga, porque tentei fazer o máximo funcional e otimizado possível, ainda tem teste quebrado.