Skip to main content
Filter by
Sorted by
Tagged with
1 vote
2 answers
111 views

I have two ordered sets (insertion order matters & I need to ignore duplicates, so LinkedHashSet) where the nth item in one set is paired with the nth item in the other set. But they aren't added ...
ElJay's user avatar
  • 379
-5 votes
1 answer
216 views

Background: I am comparing the performance of any() when used on a list versus a set for finding a known element. My initial assumption was that since any() short-circuits, the performance would be ...
Gооd_Mаn's user avatar
  • 1,085
Advice
0 votes
6 replies
115 views

I was solving the algorithm problem: find all unique substrings from the string, using sets. Here is the model solution, but I can't understand what line 6 means. Why does the end go up to length + 1? ...
Ilona's user avatar
  • 21
1 vote
0 answers
36 views

I have 3 sets: alice = {'first_kill', 'level_10', 'treasure_hunter', 'speed_demon'} bob = {'first_kill', 'level_10', 'boss_slayer', 'collector'} charlie = {'level_10', 'treasure_hunter', 'boss_slayer',...
0xYNS's user avatar
  • 43
Best practices
0 votes
6 replies
30 views

What functional or mixed functional programming languages support nested sets, akin to the usage in mathematics and set theory? Specifically those with a REPL? I tried Python and couldn't get nested ...
notaorb's user avatar
  • 2,250
4 votes
6 answers
569 views

I want to create an unmodifiable set of specific characters, and for clarity, I want to initialize that Set with a String. Right now I can do it like this: static { final String hexCharacters = &...
MiguelMunoz's user avatar
  • 5,154
Advice
0 votes
5 replies
100 views

I have some data fields gathered in a SET statement like this: set "datastr=%num_cde%, %id_achat%, %modele%, %sysfam%, %serial%, %ldt%" later assigned to an email body as: SET "...
calade's user avatar
  • 35
1 vote
1 answer
131 views

In Postgres, you can set current_user by: set session_authorization = 'new_user'; and set role 'new_user'; While I like the shorter syntax, I'm asking if there is a difference in functionality ...
Code4R7's user avatar
  • 3,236
0 votes
4 answers
187 views

How can I create objects from a Set? const dupObj = [{ id: 1, value: 'a' }, { id: 2, value: 'b' }, { id: 1, value: 'c' }]; const uniKeys = [...(new Set(dupObj.map(({ id }) => id)))]; // [ '1', '2' ]...
Run's user avatar
  • 57.7k
3 votes
2 answers
290 views

According to the Python documentation, set is a mutable unordered collection. Usually, it's implemented as a hash table that stores references to objects as its keys. Comparing to dict (which is also ...
SLebedev777's user avatar
8 votes
3 answers
1k views

I am trying to solve the problem posed in this question. Here the OP asks that given a 15 element set, its 2^15 element power set be generated in a manner such that the elements of the power set are ...
uran42's user avatar
  • 775
4 votes
2 answers
190 views

Let's say I have a box and there is a bunch of balls in that box. I can label each ball with a character while making sure no two balls get the same character as labels. I get a string this way. Let's ...
uran42's user avatar
  • 775
0 votes
3 answers
123 views

I'm learning Python coming from some beginner-level experience with Java. It all makes sense for the most part, but one of the exercises kind of made me wonder what actually happens within Python. ...
Lucas Durrant's user avatar
0 votes
2 answers
71 views

I'm working with the GAMSPy Python API and using Set objects to define sets in a GAMS model. I can define a set like this: from gamspy import Container, Set m = Container() regions = Set(m, name=&...
user30451554's user avatar
2 votes
3 answers
218 views

I want to write a computer programme that will do the following things : 1a. It will make an array 3 characters long. £££ 2a. It will then initialize the array with the string "{_}" and ...
uran42's user avatar
  • 775
1 vote
2 answers
77 views

Why the following code caused dead loop? const s = new Set([1]); s.forEach(e => { s.delete(e) s.add(e) }) I tried to change the order about delete and add operation,the dead loop ...
Turbo Zhang's user avatar
0 votes
2 answers
115 views

to clarify, it would be used like any(set()). I am asking for efficiency sake. Example: if any(fnmatch(a,b) for a in set) where a would be an item in a set and b would be a string.
arnoldpalmer's user avatar
5 votes
3 answers
298 views

Say I have a dictionary of sets like this: d = {'a': {1,2,8}, 'b': {3,1,2,6}, 'c': {0,4,1,2}, 'd': {9}, 'e': {2,5}, 'f': {4,8}, 'g': {0,9}, 'h': {7,2,3}, 'i': {5,6,3}, 'j': {4,6,8}} Each set ...
Shaun Han's user avatar
  • 2,975
0 votes
1 answer
62 views

I have a serious problem with an app. I have a selection box with types of services and other below with student names. Once selected the service, the students will be filtered to the ones that are ...
machsantos's user avatar
0 votes
0 answers
56 views

I'm looking for a way to extend the tFieldType with my own custom types. I've tried type pSetExtendedFieldTypes = (ftAlpha, ftAlphaNumeric, ftNumeric); pSetNativeFieldTypes = tFieldType; pSetDataTypes ...
user2383818's user avatar
0 votes
1 answer
175 views

in this code I think I have to write set /a counter=%counter%+1 but I just tried write it without %% and interestingly it works I don't how?! can anyone explain it @echo off setlocal ...
Mikel91's user avatar
  • 33
2 votes
3 answers
148 views

The C++ reference has this example for printing the intersection of two sets (or sorted containers): #include <algorithm> #include <iostream> #include <iterator> #include <vector&...
Michaël's user avatar
  • 608
-1 votes
1 answer
49 views

I am trying to set sublist value on suietelet in a client script. Getting error as: cannot read properties of undefined reading 0. Please advise Thank You! Below is client script sample. function ...
Maira S's user avatar
  • 121
1 vote
1 answer
63 views

Me and my colleagues have created around 14.000 copies of a certain workbook in the last 8 years or so. Pretty simple lightweight workbook, few userforms, some code, 2 sheets with a variable amount of ...
BenVenNL's user avatar
2 votes
4 answers
170 views

I've got a data type that consists of actual data and an id: struct Data { int value; int DataId; }; I've got a collection of these data from which I have to frequently get an element based ...
Oersted's user avatar
  • 4,816
2 votes
1 answer
147 views

I am trying to create a set having different values along with True, False, 1, 0. I am aware that Python treats 1 as True and 0 as False. Imperatively, since the set keeps only the unique values, my ...
Venkata's user avatar
  • 311
0 votes
0 answers
68 views

For my application, I need to track the number of duplicate transactions. Transactions are represented by a struct. type Transaction struct { items map[string]int date int } The struct ...
Alex A's user avatar
  • 376
2 votes
2 answers
126 views

I have two maps. One (A) is maps unique identifiers to allocated resources. The other (B) maps unique identifiers to resource prototypes. I would like to take the two maps and find the items that are ...
Steven's user avatar
  • 732
-5 votes
1 answer
123 views

What is this declaration? lists are declared using [ but these contain key-value pairs as seen with the use of {}. It's confusing. list with {} brackets with a pair of two items forming one. players = ...
MEHUL_PATEL's user avatar
1 vote
1 answer
73 views

I'm designing an ontology for app users in Protégé, and I need advice on how to properly model intermediate "container". Suppose you have an User with multiple contact details (e.g., ...
Adelina Vivaldo's user avatar
1 vote
1 answer
107 views

I'm debugging a program I'm not at all familiar with in Visual Studio 2022. I am trying to see the value which goes into the NumeroProjet property. In order to do this, I have put the set; on a new ...
Dominique's user avatar
  • 17.6k
1 vote
0 answers
972 views

I'm building a new server, and thought, its 2025 and probably good time to migrate from iptables, ipset... to nftables. earlier or later it has to happen any way, right? # uname -a Linux starnet 6.12....
Vaidas M's user avatar
0 votes
0 answers
61 views

The value defined by c:set refers to a var (name of the iterator variable used to refer each data), but the column values are not displayed. How should it be defined to be displayed correctly? <c:...
Andrew Churchill's user avatar
-1 votes
2 answers
91 views

I have been using batch for a while but not an expert of it. I recently wrote a piece of code to do the following thing: Get a date input from the command line. If its format is like 20200102, it is ...
DBZHOU's user avatar
  • 187
-1 votes
2 answers
218 views

You can insert an item into std::set but if there already exists an equivalent item, it won't override. You can also first remove the equivalent item from std::set and then insert the item you want to ...
Leon's user avatar
  • 1
0 votes
0 answers
41 views

I have a class like this class Point { private: int x; int y; public: Point() = default; Point(int x_arg, int y_arg):x(x_arg), y(y_arg) {}; bool operator<(const Point& ...
Baron Yugovich's user avatar
5 votes
5 answers
340 views

I marked my answer as the answer because it is the one that is doing what I was wanting and anyone wanting to do the same thing should start there. But I would love to see a better answer (order of ...
smichr's user avatar
  • 19.6k
4 votes
1 answer
135 views

Stream<String> stream = Stream.of("w", "o", "l", "f").parallel(); Set<String> set = stream.collect(TreeSet::new, Set::add, Set::...
sjk's user avatar
  • 41
4 votes
1 answer
206 views

I have a string like such: {a="foo", b="bar", c=12345} (imported & read from a file) How do I convert this into a table/set with those contents? Or how can I save tables/sets ...
Larix Duk's user avatar
-4 votes
1 answer
95 views

So I am currently making a word game, and I want to have it so that the user cannot enter a word that is wholly contained within another word (e.g. 'set' in 'subset'), however my current code: noWord =...
Daniel's user avatar
  • 1
0 votes
0 answers
76 views

I am trying to verify the following lemma in dafny: ghost predicate noD(s: seq<nat>) { forall i :: 0<=i <|s| ==> !(exists j :: 0<=j< |s| && i!=j && s[i]==s[j]) ...
Markel Barrena's user avatar
3 votes
1 answer
243 views

There are many similar questions about this, but usages have been changing; this is the only question I've found that talks specifically about MutableSets, MutableStateFlows, and collectAsState(). The ...
SMBiggs's user avatar
  • 11.8k
0 votes
1 answer
50 views

I'm trying to remap primary keys between versioned data and code releases with as small a diff as possible. I have a list of elements, e.g. [a,b,c,...,j], and some deterministic process that assigns ...
molsonite's user avatar
0 votes
0 answers
80 views

So I'm working XML files and am not quite sure if what I'm doing is 'Pythonic' enough. The XML file has tagged text and I want to get all paragraphs that contain countries and rivers. So each ...
Yuirike's user avatar
  • 41
-2 votes
1 answer
101 views

I have a Class B defined as below --> Class B { private List<String> obj1; private List<A> obj2; // Need to implement hashcode() and equals() methods } In my code, I am using ...
rishi007bansod's user avatar
0 votes
1 answer
119 views

Determining a combination of selections from a list of sets that would yield the maximum number of unique numbers Consider an array of sets, with each set containing an arbitrary number of integers. A ...
C Ho's user avatar
  • 1
2 votes
3 answers
233 views

I want to compare sets in a match expression in Python. So imagine you want to compare multiple variables but they do not have any order. They only have to include the same values as a whole. In this ...
Ichwerdennauchsonst's user avatar
0 votes
0 answers
73 views

Our sample set is given as {-1,1.5,2,2.5}. b = from "outcome" value to outcome(index100) value. There is a problem that outcome(1) cannot be equal to a matrix value. Hence I set "...
Peiman Ghasemi's user avatar
3 votes
3 answers
215 views

I have a list of (lots of) coordinates. coordinateList = [[1,2], [2,1], [3,5]]; These coordinates are unique and since I have a lot of them I want to be able to quickly check if a new coordinate is ...
Cincinnatus's user avatar
-1 votes
1 answer
89 views

Compare $string and "$string": string="xx yy zz" if [[ $string == "$string" ]]; then echo "Strings are equal." else echo "Strings are not equal.&...
showkey's user avatar
  • 505

1
2 3 4 5
243