leanprover-community / mathlib

  • Home
  • Zulip archive
  • API documentation
  • Lean web editor
  • Links

Zulip Chat Archive

Stream: new members

Topic: Getting last index of an element from list


Vivek Rajesh Joshi (May 13 2024 at 14:25):

I've been using ([my_list].indexesOf x).getLast (proofOfNonEmpty], but it's been complicating some things. Could someone give a simpler way to do this?

Gareth Ma (May 13 2024 at 14:30):

length - 1 - reverse array's first index?

Vivek Rajesh Joshi (May 13 2024 at 14:32):

Ahh, should've thought of that, thanks :thumbs_up:


Last updated: May 02 2025 at 03:31 UTC

Theme Simple by wildflame © 2016 Powered by jekyll