It's pronounced Diane. I do data architecture, operations, and backend development. In my spare time I maintain Massive.js, a data mapper for Node.js and PostgreSQL.
Break the string down into a table with one character per row, use the row_number window function to capitalize it each way, then reassemble the final product; the latter two steps can't be combined because window functions can't be nested in aggregate functions.
This is a hallmark of proper functional programming. Elm looks intimidating than more traditional grammars but it's essentially strongly-typed function composition. I love it, and the outer function reads like english.
The skipCase folding function takes care of upcasing every 2. letter. The folder is a makes it easier to map the function over both capitalization variations, which then can be applied to the input string.
A long long time ago, I started with Python 1.5 at web.de, founded the MoinMoin wiki project shortly thereafter, and am now enjoying the increased traction that Python recently gets from data science.
Scala
A good old fold and I use the
Nexttype to know which side to capitalize next.Interesting JS solution....I haven't seen ternary operators used so haphazardly before, I'm not comfortable with them still.
SQL:
Break the string down into a table with one character per row, use the
row_numberwindow function to capitalize it each way, then reassemble the final product; the latter two steps can't be combined because window functions can't be nested in aggregate functions.I'm a bit late to the party, but here's my Elixir solution:
Kinda silly solution using 2 mutually recursive functions (Haskell)
Ooh, clever! I like it!
One more Python solution:
This is a hallmark of proper functional programming. Elm looks intimidating than more traditional grammars but it's essentially strongly-typed function composition. I love it, and the outer function reads like english.
Solution in Haskell using folding:
The
skipCasefolding function takes care of upcasing every 2. letter. Thefolderis a makes it easier to map the function over both capitalization variations, which then can be applied to the input string.Here is some shit I wrote using shellscript
Ruby
Any Python version 2.7+.
😳 😱
This is the magic of python. Short. I just love it. 💗
If you return like this
return _change_even_casing(True), _change_even_casing(False)python will understand that it's already atuple