This tag is used mostly regarding associative arrays (but better use tag "associative-array" for that) and sometimes in the mathematic sense of tag "associativity", the associative property of binary operations.
Questions tagged [associative]
435 questions
3
votes
1 answer
Is "associates to the right" equivalent to being left or right associative?
If I say an operation is left-associative, is that equivalent to saying it "associates from the left" and "associates to the right"?
My confusion comes from an example in my functional programming Haskell textbook.
It states:
Function application…

Data
- 689
- 7
- 23
3
votes
1 answer
How to create an associative array from a range in D
Let's say I have an array of type Record[] and I want to create an associative array from it, key being rec.key. Is there an easy way to do it?

Danol
- 368
- 1
- 15
3
votes
3 answers
Need to push the key and value inside associative Array?
I need to push the more key and its value inside the array. If I use below code first key pair replaced by 2nd one.
For your Reference:
Code Used:
foreach ($projectData['projectsections'] as $key => $name) {
$projectData['projectsections'][$key] =…

Leena
- 43
- 1
- 7
3
votes
2 answers
Is C++ operator "*" left-associative or right-associative?
I've got a test program to try this:
int main()
{
int i = 1;
int* p, q;
p = &i;
//q = &i;//q is not pointer
int* buf[20];//type of element is int*
return 0;
}
(1) I found q is not pointer, so seems int *p the asterisk is…

Troskyvs
- 7,537
- 7
- 47
- 115
3
votes
3 answers
Php associative array sort and get key with highest length
Hey i have an associative array which has keys as String and values as Int.
So from that associative array i need to get the key which has the highest value and if multiple keys have the same value then i need the key with the highest length.
So…

Sidhant
- 421
- 1
- 6
- 17
3
votes
3 answers
Associative Arrays/Object - getting values with dot notation
I don't really get why this isn't working:
thing = {
img78:{ exifmanufacturer:"Canon", exifmodel:"Canon EOS 450D", exifexposuretime:"1/125", exiffstop:"71/10", exifiso:"200"},
img79:{ exifmanufacturer:"Canon", exifmodel:"Canon EOS 550D",…

xgarb
- 33
- 1
- 3
3
votes
2 answers
PHP: How to ensure, an array contains all combinations of values
Ok, here's the problem: I have an array with the following structure:
$array[0] 'fruit' -> 'apple', 'origin' -> 'usa', 'price' -> '$1'
$array[1] 'fruit' -> 'apple', 'origin' -> 'canada', 'price' -> '$1'
$array[2] 'fruit' -> 'pear', 'origin' ->…

amkx
- 41
- 3
3
votes
1 answer
Right associative operator in a mathematical expression parser
Finally, coming from this question, the problem remains, that this subparser...
private static void Factor(Scanner scanner, ref TermNode currentTree, ref Token currentToken)
{
Exponent(scanner, ref currentTree, ref currentToken);
while…

HerpDerpington
- 3,751
- 4
- 27
- 43
3
votes
4 answers
Prepend to multidimensional associative array
I'm PHP beginner and have a question:
I have a multidimensional associative array:
array(
"X" => array( "x1" => "1", "x2" => "2", "x3" => "3" ),
"Y" => array( "y1" => "1", "y2" => "2", "y3" => "3" ),
"Z" => array( "z1" =>…

fred
- 43
- 3
3
votes
2 answers
PHP fill up an associative array
I'm creating a data.php file which returns a json file to a html file where I fill up a grid with the data from the data.php file.
I need this to be an associative array in the following form:
[
{"CompanyName":"Alfreds…

Marc Van der Smissen
- 31
- 1
3
votes
2 answers
merge two arrays with index in one array and values in another perl
How can I merge two arrays together as an associative manner; one array having the key column names, and the other the values?
I have tried to push one array upon the other, put only appends them as a list, does not associate them together. Any help…

Luis Berumen
- 35
- 2
3
votes
1 answer
Bash : Use a variable as an associative array name
I'm writing a Bash script to simplify file copies from our main site to multiple agencies.
In this script, I'm trying to use a variable as an associative array name but I optain an error, here is the code :
#!/bin/bash
declare -A GROUP1
declare -A…

Jaymzwise
- 31
- 5
3
votes
1 answer
Pass associative array of objects
I'm having a problem passing an associative array of objects to MVC Controller. I always get null.
This is what I have on client-side:
function Item() {
this.ItemId = GetRandomId('i');
this.Title = '';
this.Questions =…

tincho87
- 349
- 1
- 4
- 12
3
votes
3 answers
jQuery Get associative array Key from index
My question is the following, in an array:
var array = new Array();
array['abc'] = 'value1';
array['def'] = 'value2';
How do I get the associative key of an array if I have its index number? Let's say I want associative key of arr[0]'s…

Gingi
- 145
- 8
3
votes
2 answers
Haskell Folding commutative, associative functions on Foldables containing bottom type
I recently tried running the code:
> let _l_ = _l_
> any [True, _l_, False]
True
> any [False, _l_, True]
> -- _l_
I was wondering if this is considered correct behavior since any is defined as foldr (||) False and || is associative and…

user2063685
- 159
- 6