Questions tagged [remove-if]

Common Lisp 'remove-if' function.

Common Lisp 'remove-if' function.

It's signature is:

remove-if test sequence &key from-end start end count key => result-sequence

CLHS: remove-if

201 questions
2
votes
2 answers

lambdas in removeIf

HashSet liczby = new HashSet(); liczby.add(1); liczby.add(2); liczby.add(3); liczby.add(4); liczby.removeIf ((Integer any) -> { return liczby.contains(3); }); for(Iterator it = liczby.iterator(); it.hasNext();){ …
2
votes
3 answers

C++ remove_if without iterating through whole vector

I have a vector of pointers, pointing to approx 10MB of packets. In that, from first 2MB, I wanna delete all those that matches my predicate. The problem here is remove_if iterates through the whole vector, even though its not required in my use…
Novajik
  • 47
  • 6
2
votes
4 answers

Remove items from list according to a list of indexes

I have a list of items like so: A = [[0 A B],[1 C D],[2 E F],[3 G H],[4 I L],[5 M N],[6 O P],[7 Q R],[8 S T],[9 U Z]] I then define another list like so: index = [0,2,6] My goal is to remove the lists 1, 3 and 7 from A so that the result is: A =…
Federico Gentile
  • 5,650
  • 10
  • 47
  • 102
2
votes
2 answers

How can I remove a spcific html meta tag with php?

I would like to this: If php found this specific meta tag in the html source,then delete from header:
2
votes
3 answers

remove_if on a map trying to pass a const as a non-const - why?

Here's a bit of code which is supposed to filter out the elements of a map which satisfy a predicate, into a new map (MCVE-fied): #include #include #include using namespace std; int main() { …
einpoklum
  • 118,144
  • 57
  • 340
  • 684
2
votes
2 answers

remove words of a text file from a map in C++ without loop

I try to make a set to store certain words of a text file. Then I want to remove these words from a map, which I already made up. I have successfully made a set to store these words, but I cannot remove them from the map. Besides, I cannot use a…
Frank
  • 91
  • 7
2
votes
1 answer

How do delete empty cells of a vector if using remove_if

I am filling a std::vector with some object. this vector instance as defined in the following line: std::vector< std::list< pcl::PointXYZRGB>> tab; I now want to delete the empty cells. I tried like following: tab.erase(remove_if(tab.begin(),…
lotfishtaine
  • 111
  • 1
  • 3
  • 10
2
votes
3 answers

How to remove a customized object using stl remove from container set?

Following is the class and container class student { std::string name; int id; } set s; // sorted by id that i have done correctly class compare { public: bool operator()( Student* s1, Student* s2) { return…
Suri
  • 3,287
  • 9
  • 45
  • 75
2
votes
1 answer

Removing separate list of items from another list in Python 3.x

I have a list that contains a lot of tagged bigrams. Some of the bigrams are not tagged correctly so I want to remove them from the master list. One of the words of a bigrams keeps repeating frequently, so I can remove the bigram if it contains an…
Mohammed
  • 1,364
  • 5
  • 16
  • 32
2
votes
1 answer

LISP: Removing elements from list already existing in another

Can anybody explain to me why this: (remove-if #'(lambda (var) (member var (list "x"))) (list "x" "y" "z")) returns this: ("x" "y" "z") but this: (remove-if #'(lambda (var) (member var (list 1))) (list 1 2 4)) returns this: (2 4) ?
2
votes
2 answers

Removing sublists in a list by comparing them with an alist in Common Lisp

This is complicated, and I'm hoping there's a simpler way to do it. I'm comparing a freshly generated list of "suggested connections" for a social networking site against a "blocked suggestions" list. The first list looks something like this: ((12…
tangopianist
  • 149
  • 1
  • 8
2
votes
2 answers

how to dynamically add/remove multiple divs using jquery

In advance, I apologize if one of the other posts contained my answer. However, I DID review them, but perhaps my naiveté prevented me from completely understanding how to incorporate the posted code into my page. In any case, I would sincerely…
user3059798
  • 21
  • 1
  • 2
2
votes
2 answers

std::remove_if using other class method

I want to use std::remove_if with a predicate that is a member function of a differenct calss. That is class B; class A { bool invalidB( const B& b ) const; // use members of class A to verify that B is invalid void someMethod() ; }; Now,…
Shai
  • 111,146
  • 38
  • 238
  • 371
2
votes
3 answers

Iterating over std::vector with lambda does not want to remove with remove_if

I have a small problem with lambda expression while using remove_if on std::vector I have a following piece of code : std::remove_if( openList.begin(), openList.end(), [&](BoardNode& i){ std::cout<< i.getCoordinates() <<…
Patryk
  • 22,602
  • 44
  • 128
  • 244
2
votes
1 answer

Is remove_if predicate guaranteed to be called only once per iterator?

I've been reading the latest C++ spec, and I'm unable to figure out whether or not remove_if can be called multiple times for the same element. In particular, I'm looking at std::remove_if being called on deque iterators. So far as I can figure,…
Mahmoud Al-Qudsi
  • 28,357
  • 12
  • 85
  • 125