Jump to content

Get last array element VIM


Jacemdom

Recommended Posts

There already is a primitive that does this.  The Delete From Array returns the last element in the array if nothing is wired to the length and index.  There was a thread on LAVA years ago about which was a faster method, and a few versions of LabVIEW the method you showed was faster, but in most the delete from array is faster.  And it already has a quick drop dfa.

  • Like 1
Link to post

It's a personal preference but I don't like using delete array for that purpose because I think it's confusing. I'm sure it costs me a few milliseconds when I see it and think "why would I want to delete an element from that array?" We want code that's easy to read not easy to write right?

Link to post

I get your point, and there is large amounts of debate over similar topics.  Should I not use Variable=Variable++ since not all developers know this is short hand for incrementing a variable?  To me the delete from array with nothing wired is used for getting the last element, but I get not everyone associates this function with that feature.

But I suppose if you really feel strongly about this you could make a VIM that just has this one primitive in it.

Link to post
On 12/7/2017 at 8:31 AM, hooovahh said:

There was a thread on LAVA years ago about which was a faster method, and a few versions of LabVIEW the method you showed was faster, but in most the delete from array is faster.  And it already has a quick drop dfa.

Thread in question.

Once the stomping was fixed in the Delete From Array (supposedly in 2014), that became a lot faster than any other method.

Edited by crossrulz
Link to post

A “last element” VIM would be clearer than using “delete”, as it could have an icon that suggests the last element   I use a “first and last element” VIM because I often need both to determine ranges.

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.