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
3
votes
1 answer

Are STL predicates allowed to use their argument's address?

When writing a custom predicate function/functor to pass to an STL algorithm, is the predicate allowed to use the address of its argument? Here's the problem that inspired the question. I have a vector vec, and a vector inds, which contains some…
SuperElectric
  • 17,548
  • 10
  • 52
  • 69
2
votes
3 answers

c++ STL algo remove_if used with template

I tried to apply stl algorithm remove_if on template, and met some trouble. Any help is appreciated! template bool flag_delete(pair a) {return (a.second == 1);} template void fun_delete_by_flag(vector &vec_data, ivec…
2
votes
2 answers

c++ vector; remove_if only removing a single value?

I'm supposed to implement a function that erases a range of values from containers. So eraseRange(v, 1.5, 24); for example would delete any value greater than 1.5 and less than 24 from the container v. And my function works perfectly for lists,…
Fault
  • 1,239
  • 4
  • 14
  • 18
2
votes
1 answer

how to extract rows in dataframe based on another list

I have cleaned up one of the columns in a set of data boxes and generated a list, then I now want to extract the entire data box that matches the cleaned up data (list). For example, I have a cleaned list: x = c(1,2,3,4,2,1,3) and my original…
cc Li
  • 37
  • 4
2
votes
1 answer

Javascript - localStorage issues

In the script below, I want to be able to display on the main html page lists of paragraphs saved in the localstorage. In the html I defined an are with the id "content". I want to display the texte stored in the localstorage in this area. In the…
dam's
  • 33
  • 1
  • 6
2
votes
2 answers

Removing rows that do not match a certain condition in r

I have a dataframe with multiple columns and I would like to remove rows that do not meet a certain condition. I would like to only keep the rows that have a -1 followed by a 1 in the dataframe in one of the columns. Example data.frame column a …
2
votes
1 answer

HASKELL --- Is there any function to remove an element in a list?

My problem is I have a list and want to remove some strings in it. but when I remove the first time it's OK. but the second time, it removes the string but bring back the first one. do you know how I can avoid this? thank you Prelude Data.List…
Bilal
  • 53
  • 4
2
votes
3 answers

jq conditional delete from array

I have this json i got from aws, this is just a test i created not my actual rules [ { "Name": "Fortinet-all_rules", "Priority": 0, "Statement": { "ManagedRuleGroupStatement": { "VendorName": "Fortinet", …
Tnimni
  • 53
  • 1
  • 8
2
votes
3 answers

jquery remove list item where it is empty

I need to remove the li elements…
Chico T
  • 21
  • 1
2
votes
1 answer

(Swift) What is the easiest way to delete all elements in array when condition is true

setsOfCardsByLevel is an array of cards. Every card has a level. I want to remove all cards from array if their level is equal to level from the parameter. Here is my function: func removeCardsByLevel(_ level: Int) { for card in…
faris97
  • 402
  • 4
  • 24
2
votes
1 answer

How should i use remove_if to delete elements in range of two numbers

I created Class and initialised a vector inside private field, then i initialised vector by useing methods of my Class. Now i need to delete elements in range of two numbers which i have to type on a keyboard #include #include…
AndrewMemo
  • 37
  • 4
2
votes
2 answers

Remove in depth elements using streams

I have the following classes. Class A { List b //getters and setters } CLass B { List c //getters and setters } Class C { List d //getters and setter } Class D {} What i want to do is remove list d if a specific…
Nana
  • 55
  • 8
2
votes
1 answer

Error C2064: term does not evaluate to a function taking 1 argument - Lambda function

I am getting the following error when building my code: Error C2064: term does not evaluate to a function taking 1 argument I read the other posts concerning this error and added the keyword this inside my lambda function but I am still getting the…
Grillteller
  • 891
  • 10
  • 26
2
votes
1 answer

How to remove rows that are not relevant - R?

I need to calculate the average rating for a movies dataset, but some movies have only one review or a few reviews. I need to the dataset to keep the rows that have at least 10 reviews how do I do it? When I run the code below, I get only 5 star…
bgg
  • 131
  • 7
2
votes
3 answers

Remove object from Arraylist If it equals userinput and else print out something only once

I have been trying most things now but it doesn't seem to work. I want to remove a specific object from an Arraylist if the user enters a specific name. And if not I want the program to print "Can't find dog". I have a getName and toString method in…
1 2
3
13 14