Questions tagged [operators]
Operators are symbols that occur in nearly all programming and coding languages, used for performing calculations, comparisons, and assignments of data. Use this tag for any questions relating to operators, in any language, including things such as syntax, behaviour and use.
operators
7,827
questions
0
votes
0
answers
51
views
What does a caret and an equal sign (^=) do in Python? [duplicate]
I was looking at the solution to a Python problem, and in it was
int ^= num
I don't understand what it means.
When I searched for it, I got a bunch of posts explaining what the caret sign does on its ...
0
votes
1
answer
58
views
How to Implement operator-> for a Custom UniquePtr Class in C++? [duplicate]
I am trying to write my own implementation of unique_ptr in C++, and here is my UniquePtr header file:
#include <iostream>
template <typename T>
class UniquePtr
{
T* ptr;
public:
...
1
vote
1
answer
79
views
How does the arrow operator in haskell make sense in functions that take more than one parameter?
FYI: Second day into Haskell
MRE (what the function does, does not matter):
foo :: Int -> Int -> Int
foo x y
| x == y = x + y
| x < y = x
| x > y = y
This is what ...
0
votes
1
answer
59
views
How to parse search engine keywords input
I'm implementing a tool that lets users search for terms in texts. I'm currently focused on handling more complex input from the search.
The operators I am looking to support are :
| = OR
& = AND
...
-5
votes
0
answers
67
views
How can i do it (c++) [duplicate]
How do I make the "not equal to" operator display as ≠, like shown in the screenshot?
I don't like to show it as "!=".
I am trying to do this, but I couldn't figure it out. Could ...
2
votes
1
answer
75
views
How do I parse Python-style chaining operators in Haskell using parsec?
In the project I'm currently working on, I construct the expression parser in parsec. The code is something like:
opTable :: [[Operator Parser Expr]]
opTable =
[
-- ...
[ InfixL $ ...
2
votes
1
answer
46
views
Understanding Array comparison while using custom data types with numpy
i have a question regarding comparison with numpy arrays while using cusom data types.
Here is my code:
import numpy as np
class Expr:
def __add__(self, other):
return Add(self, other)
...
-1
votes
1
answer
54
views
friend operator << and >> in base class without child class but still called
Why is the operators << and >> called in base class if they are defined as 'friend' when calling << and >> in child class?
Code:
#include <iostream>
#include <memory&...
0
votes
1
answer
74
views
Use defined operators from base class in inherited class
Assume I have a base class
class Vector
{
public:
Vector(const std::vector<float> &elements);
static Vector add(const Vector &v1, const Vector &v2);
Vector Vector::...
1
vote
1
answer
19
views
ComputeError with polars dataframe while trying to pass a column expressions in a simple shift() operation
Sorry, I'm starting out in Polars. Is there a way to achieve the same functionality of the shift(n) function where n is a dataframe variable.
When I try:
df = pl.DataFrame({
"a": [1, 2, ...
0
votes
0
answers
22
views
How do I define a custom method for @ operator? [duplicate]
Numpy uses the @ operator for matrix multiplication between two arrays.
I have my own class for which I want to define a method using the @ operator.
How should this be done? I define my own __add__, ...
0
votes
1
answer
42
views
How to getline from txt file and check if it is correct with what the user inputed
I am creating a bank application.
So far, I can create an account. After that, it encrypts the data like password and SSN. After that, it takes me to the login function where I have to enter my user ...
0
votes
1
answer
34
views
How to use otel collector to collect some CRD resources?
Does there are any solutions that I can use to collect resources for Operators, Helm Charts, CRD hierarchies and CD configurations via otel collector? All of them are not build-in resources for ...
0
votes
0
answers
26
views
Airfllow: Having a Custom Sensor Operator inside of python operator
I have a dag task called check_file that is responsible to check the file in remote location.
check_file = PythonOperator(
task_id='check_file',
python_callable=check_file,
...
0
votes
1
answer
37
views
Remove boilerplate code when writing operator overloads
When I made my vector3 struct I noticed the operator functions were almost identical to eachother
vector3 vector3::operator+(float scalar) const {
return vector3(x + scalar, y + scalar, z + ...