2,250 questions
Advice
0
votes
4
replies
112
views
Test Equality of Infinite Lists
In Haskell, how should one test the equality of two infinite lists?
With finite lists, one might try:
listEqual :: Eq a => [a] -> [a] -> Bool
listEqual l0 l1 = and $ zipWith (==) l0 l1
But ...
0
votes
1
answer
101
views
.NET Equals override not being called inside FirstOrDefaultAsync
I'm in a .NET 6 web application with EFCore, and I have these boilerplate abstract classes and interfaces for defining entities. I know it's quite a number of complexity layers, but it really helps me ...
0
votes
3
answers
97
views
is there a difference between elements created dynamically with JavaScript and elements in HTML
take the code below:
contentsDiv.innerHTML = container.outerHTML;
if(contentsDiv.firstChild === container) console.log('true');
in this code, contentsDiv is a div created in my html file ...
-1
votes
3
answers
298
views
Why don't anonymous types overload the == and != operators (but records do)? [closed]
The Equals and GetHashCode methods on anonymous types are overridden to make them work in such a way that two instances of the same anonymous type are considered equal only if all their properties are ...
0
votes
1
answer
77
views
Python pickled object equality guarantees
I am wondering if, and if so which guarantees there are about the pickle module when using pickle.dump[s].
Specifically for my problem I am pickling list[T] where T can be bool, int, decimal, time, ...
1
vote
4
answers
134
views
Class I made not showing up as equal when equal [closed]
I have a custom class for holding a collection of quotes in swiftData in my app.
It looks like this:
@Model
final class CollectionData: Equatable {
var name: String
var data: [Quote]
var ...
0
votes
2
answers
105
views
Is it possible to create an equals override for an untyped class and it's typed counterpart?
I have two classes, non-generic BindingFilter and generic BindingFilter<T>:
public class BindingFilter
{
public object Value { get; set; }
public string Member { get; set; }
...
0
votes
0
answers
39
views
How to implement a custom equality comparison which can test pd.DataFrame attributes?
I have a custom dataclass, which is rather lage (many attributes, methods). Some attributes are pandas dataframes. The default __eq__ comparison does not work for the attribtues which are pandas ...
0
votes
1
answer
107
views
Compare coefficients across different regressions in R
I would like to test if the coefficients across different regressions are the same in R and I am not sure how I should do it.
Let me illustrate. I have an independent variable of interest called treat
...
0
votes
2
answers
206
views
Comparing reference type Objects by value without overwriting Equals methods manually
This might be a beginners question, but I have a problem for which I could not find an existing solution and was hoping you could help me here.
I would like to compare instances of a reference type ...
0
votes
1
answer
91
views
Verifying all objects in a Kotlin collection match without overriding equals
I am working on a kotlin function that needs to verify that all objects in a collection have the same value for a particular property. Normally I would simply use distinctBy() and check that the size ...
3
votes
1
answer
502
views
Override Equals method on records
Consider this Minimal Reproducible Example.
Point point1 = new Point(1, 2, 3);
Point point2 = new Point(1, 2, 31);
Console.WriteLine(point1 == point2); // True
Console.WriteLine(point1.Equals(point2)...
1
vote
2
answers
414
views
Efficiently check for equality of memory blocks in C/C++
I'm interested in the most efficient way to check for equality of memory blocks.
Currently, I use memcmp(...) == 0 to determine if two memory blocks are equal. While this works, memcmp is designed not ...
-3
votes
3
answers
2k
views
Compare lists of string in terraform
What's the best way to compare two lists of string in terraform?
["arm64"] == ["arm64"] evaluates to false
My use case is constructing lambda extension ARNs based on ...
3
votes
3
answers
248
views
Understanding the details of equality in Python
When trying to construct an example where a == b is not the same as b == a, it seems that I have accidentally constructed an example where a == b is not the same as a.__eq__(b):
class A:
def ...
3
votes
1
answer
375
views
Comparing hashtables in Pester
What's the correct way to compare hashtables in Pester tests?
i.e. the following gives the error: InvalidResult: Expected System.Collections.Hashtable, but got System.Collections.Hashtable.
$expected =...
8
votes
1
answer
343
views
A type with `Eq a` but not `Ord a`
In (an idealized version of) Haskell, is there a concrete type a such that we can implement Eq a lawfully, but it is impossible to implement Ord a? The order doesn't need to be meaningful, and any ...
0
votes
1
answer
76
views
How to solve an inequality that contains standard deviation in python?
I have the past 19 days of stock price stored in the pd.dataframe and I am trying to find out the price P that is smaller than (mean - 2.5*standard deviation), where mean and standard deviation are ...
1
vote
1
answer
159
views
== and Equals for Tuple<object>
i have a question why it works like this
var a = new Tuple<object, object, object>(1, 1, 1);
var b = new Tuple<object, object, object>(1, 1, 1);
Console.WriteLine(a.Item1==b.Item1);//...
0
votes
1
answer
117
views
Is there anything wrong with checking two hex values using == in C? [closed]
Code:
#include<stdio.h>
#include<stdlib.h>
unsigned char
s(const unsigned char x) {
static const unsigned char aes_s_box[16][16] = {
{0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F,...
0
votes
2
answers
232
views
c# equality check for class containing reference type properties
If we have a class that contains properties/fields of other reference types, how would a proper and elegant equality check be performed?
For example, MainClass contains properties of SubClassA and ...
1
vote
0
answers
29
views
angularjs, filtering, returning equal results
I am filtering using AngularJS. Everything works fine, but I want a filter to work differently. If "1" is searched, the result should only be "1". I would like your help regarding ...
-2
votes
1
answer
59
views
Why is my while loop with python not working? [duplicate]
I wrote this code to ask the user for options A, B, or C and show a message afterward, but even if I type the correct options, it still sends me the 'try again' message. what can I do so the program ...
1
vote
0
answers
54
views
In MATLAB, why does arr==el sometimes fail to find element el in array arr? [duplicate]
In MATLAB R2016a, suppose that I define the array arr = -0.2:0.1:0.2. I may then find the location of the value el = 0.1 with the command idx = find(arr==el). This correctly yields idx = 4.
But now ...
2
votes
0
answers
59
views
In Scala 3, should 2 dependent types that depends on 2 equal & singleton objects perceived to be equal? Why or why not?
In the following example (my attempt to mimic section feature of LEAN4 prover), I have declared 2 special axioms that allows 2 objects of type Gen[T] to be perceived equal and can be cast to each ...