Ad
  • Custom User Avatar

    @lucas456645 did you even read what Clever means there?

    Vote this solution as being clever. Clever solutions tend to be very creative or make use of obscure language features. They usually are not code that you would want to put into production.

  • Custom User Avatar

    52 people have literally marked it as "clever"

    53 now

  • Default User Avatar

    Yeah, I see your solution, I guess if you work hard for the next 15 years you will see why those 52 people had that opinion. Good look!

  • Default User Avatar

    52 people have literally marked it as "clever" which is what I am referring to and this is obviously my opinion so whatever neckbeard

  • Default User Avatar

    Well, the solution was not meant to be "clever" (whatever you might think that is), it was meant to work, whick it does. If you don't see what's going on by just looking at it, don't assume any other dev will struggle the same way.

  • Default User Avatar

    I undestand exactly what it is doing. what ditproz has said is correct. It is a perfectly adequate solution but it is not "clever" and it will not feel clever in 6 months when you have to explain to the junior devs what is going on

  • Default User Avatar

    Hey, don't blame the solution if you are not smart enough to understand it lol

  • Custom User Avatar

    There's a few things that might clarify this.

    1. Clearly written tests
    2. Breaking this up into steps (imperative) and aliasing the output at each step by using constants
    3. Having a clear function name to detail what this is actually doing (this is down to the challenge designer)
    4. Making the map anonymous function a named function to communicate what it's doing

    I guess it's a question of how developers treat these challenges and programming styles. I have been on teams where functional code clearly written, named and tested still throws developers because the style is very different from the imperative style.

    | Someone will come back to this in 6 months and not have any idea what it is doing

    Yeah, probably this will happen with a junior. Without any of the improvements suggested.

  • Default User Avatar

    not clever, too hard to understand. Someone will come back to this in 6 months and not have any idea what it is doing

  • Custom User Avatar
  • Custom User Avatar

    -__-, so simple ? xD I try hard on that.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution