Questions tagged [predicates]

Predicates are functions that return the boolean values, `True` or `False`.

In computing, Predicates are functions that return the boolean values, True or False. Some languages and frameworks treat them specially.

See also Wikipedia.

There are alternate (and possibly more mainstream) meanings. See Wikipedia.

108 questions
4
votes
2 answers

Is it possible to get an IQueryable<> back from an EF set when you apply a predicate?

It appears to return IEnumerable rather than IQueryable: method parameter: Func predicate code: var allCats = _catEntities.GetCats(); // IQueryable if (skip.HasValue) allCats = allCats .Skip(skip.Value); if (take.HasValue) allCats =…
NibblyPig
  • 51,118
  • 72
  • 200
  • 356
3
votes
2 answers

NHibernate with LINQ (predicates?)

Please forgive me if I am somewhat unclear, I am just getting started with NHibernate/LINQ/Lambda expressions, and I am actually unsure of what to look for... I've been working with .NET 2.0 for the past 4 or 5 years and had no opportunity to evolve…
Seb
  • 778
  • 1
  • 9
  • 27
3
votes
1 answer

Problem with Predicates in C#

I have the following method definition (EDITED to remove redundant generic): public static T SearchAgaistValues(Dictionary input, string key, List values, Predicate match, out string[] cmdParams) My simplified requirements…
IamIC
  • 17,747
  • 20
  • 91
  • 154
3
votes
1 answer

Fetched Properties inside NSFetchedResultsController's predicate

I have an Artist object with a .localConcerts fetched property (basically a subset of the full .concerts set), can I use that property inside my NSFetchedResultsController predicate? Here's what I'm trying: NSFetchRequest *request = [[NSFetchRequest…
samvermette
  • 40,269
  • 27
  • 112
  • 144
3
votes
3 answers

Java filters, how to extend the filter?

Java streams' filters use Predicates to allow or deny an element through the stream. Thanks to .compose or .andThen the filter can be restricted. Yet what if I wanted to have it more permissive according to some flags? For example, I might want to…
3
votes
0 answers

Antlr4 actions and predicates in lexer fragments

I am trying to create lexer rules for dynamically determined batch separator in Antlr4. This supports two use cases: different database systems define their own batch separators (e.g. 'go', ';' '/') I also want to allow user defined batch…
Cod.ie
  • 380
  • 5
  • 14
3
votes
2 answers

using comparison function in stl container

Why can I do this: stable_sort(it1, it2, binary_function); but not this: priority_queue, binary_function> pq; Why can I use a function in the first case, but need an object in the second?
Baruch
  • 20,590
  • 28
  • 126
  • 201
3
votes
1 answer

JPA CriteriaBuilder find entity which has elements with certain attributes in collection

I have an entity which contains a list of elements and now I want to search over attributes of these elements. This constraint should be "and" connected. Please see these simple example: @Entity public class Parent { @Column …
Christian
  • 113
  • 1
  • 3
  • 8
2
votes
1 answer

converting logical true/false to numeric 1/0?

In most languages I can either directly multiply logical truth on some numeric value, or at least there are simple function for converting type Boolean to some specific type, like int, or double. Normally, it is easy because "true" or "false" is…
Asdf
  • 300
  • 2
  • 9
2
votes
1 answer

XQuery expression with predicates

I'm trying to use an expression with a predicate to display the child nodes for each parent node (the exercise looks silly because this is test data: the final solution has to draw in data from other xml files). A sample of the data is as follows:…
2
votes
1 answer

Count query Core Data predicate

i have a entity called schedule that has many alarms (other entity), i want to get only schedules that have less then 30 future alarms. Searching all around i get that query that not works /: let predicateFutureAlarms = NSPredicate(format:…
user1779394
  • 141
  • 13
2
votes
4 answers

Ransack Search Id and Strings Together

I am trying to search using Ransack but having issue when i am trying to search id and string together like :id_or_title_or_user_username_cont It produces the error ActionView::Template::Error (PG::UndefinedFunction: ERROR: operator does not…
Fakhir Shad
  • 1,071
  • 8
  • 20
2
votes
1 answer

Strange behavior when checking assertions in Alloy

I am trying to check for verifyingUndefinedFields assertion in the following model: module Tests open law6_withStaticSemantic assert verifyingUndefinedFields { some fa:FieldAccess | fa.pExp in newCreator && fa.id_fieldInvoked !in…
Tarciana
  • 113
  • 10
2
votes
1 answer

How to get duplicate elements in array list using guava predicates

I have a array with set of elements. I need to find the duplicate elements in that array by comparing particular field using guava predicated in java. For example: I have an arraylist with set of employees details. I need to find details of…
Krieger
  • 31
  • 1
  • 6
2
votes
6 answers

How to delete elements from a transformed collection using a predicate?

If I have an ArrayList dblList and a Predicate IS_EVEN I am able to remove all even elements from dblList using: Collections2.filter(dblList, IS_EVEN).clear() if dblList however is a result of a transformation like dblList =…
Ditz
  • 735
  • 7
  • 17