Ad
  • Custom User Avatar

    uh, clearly you know about how haskell works, which is good, but you've made weird assumptions about what JS does. Of course it depends between which engine we're on, but since nodejs powers most of the web (as well as is what codewars uses), new arrays are only allocated as needed if the engine decides it can't butterfly the previous array for the correct shallow references that don't get dirty (which is extremely easy to do when it receives the Boolean function, which is pure and doesn't pollute elements being passed through). What actually ends up happening is that most of javascript, unlike java, isn't executed on pure logic that is defined by its exact behaviour and has faster implementations compiled JIT (just in time) on the runtime so that it looks like new arrays need to be properly created where as in reality (happening behind the curtains) it's just the same heap being frankensteined into an efficient array-like item until the array prototype is used and forces the array to actually be constructed.

  • Custom User Avatar

    arrays are lists when the differences are irrelevant such as for this use case.

  • Custom User Avatar

    Users allergic to math are allowed to skip math related kata's.