Ad
  • Default User Avatar

    Resolved.

  • Custom User Avatar

    Fixed with your suggestion, thanks :)

  • Custom User Avatar

    The more we talk, the more I think that the λ2 calculus isn't up to this task.

    (╯`д´)╯︵ ┻━┻ Time to drop haskell, climb the λ Cube, and redo everything Agda! Where's my axiom of infinity? I have a craving to construct ℕ from scratch...


    Kidding aside, for 8 kyu kata in other languages, the convention is to not sweat the corner cases...

    I think the way you did it (using undefined) is the most mathmatically sound way, but it gives no help in fixing the error (generic "Prelude.undefined" error message).

    Yeah, you're right. I just switched it from undefined to error "elementAt is not defined for non-positive input"

  • Custom User Avatar

    Perhaps it should throw an exception like the built-in (!!). Personally, I don't like throwing exceptions, so I'd rather return Maybe a instead. However, since this is an absolute beginner kata I don't think this is a good place to introduce Maybe...