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
0
votes
3 answers

Search an object in a List with many object's attributes

I have this List list. MyObject looks like this : public class MyObject { String typeOfObject; Integer anInteger; Integer value; } How to get the object(s) from list where typeOfObject = "objectA" and anInteger = 1 ? My…
BnJ
  • 1,024
  • 6
  • 18
  • 37
0
votes
1 answer

Using predicates in Alloy

I am trying to use two predicates (say, methodsWiThSameParameters and methodsWiThSameReturn) from another one (i.e. checkOverriding) but i receive the following error: "There are no commands to execute". Any clues? I also tried to use functions but…
Tarciana
  • 113
  • 10
0
votes
1 answer

How do I define a sort predicate for a templated container class in C++

My C++ is a little rusty as of late. Can one of you gurus help me define a SORT predicate, for a Container Class, with a template parameter which it self is a another class. template class OrderedSequence // Maintains a sequence of…
Cosmic OM...
  • 181
  • 4
  • 14
0
votes
1 answer

How would you turn these English sentences into predicate logic?

The sentences are: Real number i is the largest real solution of the equation f.i = i + l. No integer is larger than all others. I feel like the first one is a for all statement, but I have no idea about the second one, at all. Any help would be…
0
votes
2 answers

Predicate method syntax

I made a class with these methods: def promotion_available? promotion.present? end def promotion @promotion ||= PromotionUser.user(@user.id).available.first end Then, a colleague removed the promotion method, and changed the predicate…
easteregg
  • 149
  • 9
0
votes
1 answer

algorithm of make_heap() function in

I was just experimenting with make_heap() function in C++. Following is the code where I am keeping a track of the elements that are being compared every time the bool predicate() is called, by printing them. #include #include…
Nishant
  • 409
  • 6
  • 16
0
votes
1 answer

libxml2 predicates in xpath expression are not always recognized

I appeal to you because I have problems in using the libxml2 library that does not take into account certain parameters in my xpath expressions. Here is an example of xml file that I am trying to parse:
0
votes
1 answer

Prolog Relational Tracking without Lists

I am trying to get a predicate to relate from 1 fact to another fact and to keep going until a specified stopping point. For example, let's say I am doing a logistics record where I want to know who got a package from who, and where did they get…
user2020331
  • 13
  • 1
  • 3
0
votes
1 answer

SQL How to extract a predicate from a left join

I have 2 tables: user and licenseduser. The first one contains all the users and the second one contains only those users with a licenses (2 columns: useruid and subscriptionid). Given a subscriptionId I have to display in a grid all the users and a…
lontivero
  • 5,235
  • 5
  • 25
  • 42
0
votes
3 answers

Search matched list in dictionary

public class Filter { public List A { get; set; } public DateTime Start { get; set; } public DateTime End { get; set; } } var f1 = new Filter(){A = new List() {1}} var f2 = new Filter(){A = new List() {1 , 4, 2}, Start =…
Saint
  • 5,397
  • 22
  • 63
  • 107
0
votes
2 answers

Interpret lambda expression for custom selection

I'll need to expose a bit of background before going further: I have a project that uses nHibernate and some generic repository to forward predicates and return entities as follows: public abstract class GenericRepository< T > { ... public…
Seb
  • 778
  • 1
  • 9
  • 27
-1
votes
1 answer

STL C++ isgreater template

when sorting a vector i am using the following code sort(vec1.begin(), vec1.end(), less()); compiler accepts the third argument which is also the default argument. But for sorting in descending order i see greater() on every forum but…
-1
votes
1 answer

c# How to perform multiple validation and return error message with predicate

just see a sample code where multiple functions are getting called to perform validation and if any one validation fail then return false to calling environment and if all pass then return true. how to customize the routine as a result when any…
Monojit Sarkar
  • 2,353
  • 8
  • 43
  • 94
-1
votes
1 answer

Delegate Predicates Usefulness

The sample below, shows uses a predicate to evaluate a condition with hard-coded value of 100000. There is no way to add an additional parameters to the FindPoints method, for it would violate the predicate param constraint. This brings the value…
I Stand With Russia
  • 6,254
  • 8
  • 39
  • 67
-1
votes
1 answer

vb.net predicate wrapper error

So I have a some code I've been using for quite a while and it has worked fine. This project is rather large so I'm using a detailed namespace and I can't get it to work. I've used this a hundred times, but I get this error on this project: Method…
kylemac
  • 189
  • 4
  • 19