Ad
  • Custom User Avatar

    It's possible, but any real Haskeller will never use length and !! only reluctantly - precisely because linked lists are not arrays.

    Actually, xs !! (length xs - 2) would still be O(n). That too would go against the essence of the kata though.

    Oh never mind. But I'm still not making a JS translation.

  • Custom User Avatar

    Though... I have written a Rust translation that has been approved. I didn't know the original language was Haskell. Though... I am not sure it makes such a difference, it's possible to write a similar solution based on indices in Haskell...

  • Custom User Avatar

    Ah, sorry, the original translation was already approved. I thought you resurrected it. Never mind!

  • Custom User Avatar

    I haven't written the translation, I only made decent tests (look diff ;)).

  • Custom User Avatar

    Was it a good idea to translate this kata to Python?

    Linked lists are not arrays and arrays are not linked lists; the essence of the kata seems lost in translation.