Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: deleting an entry from intvec
PostPosted: Sat Dec 12, 2015 1:40 am 

Joined: Sun Mar 02, 2008 10:17 pm
Posts: 11
How do I delete an entry from an intvec? Could not find any function that does it.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: deleting an entry from intvec
PostPosted: Mon Dec 14, 2015 11:15 am 

Joined: Wed May 25, 2005 4:16 pm
Posts: 275
Assume you want to delete the ith entry from an intvec v of length >=2:
Code:
if(i==1) { v=v[2..size(v)]; }
else
{
  if(i==size(v))
  { v=v[1..i-1]; }
  else
  { v=v[1..i-1],v[i+1..size(v)]; }
}


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

It is currently Fri May 13, 2022 10:58 am
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group