python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
a python question about list, append and mutability
Here is my code:
list1 = ["dog", "cat"]
list2 = list1
list2.append ("fish")
print(list1)
print(list2) # both list1 and list2 will be [“dog”, “cat”, “fish”].
I do unde...
Betty
Votes: 0
Answers: 0
While loop with next() vs foreach
I was going through some third party code and I ran onto this snippet for going through an array. Since this is a respectful code base I'm wandering what is the secret behind the trouble of moving int...
Chupacabra
Votes: 0
Answers: 1
Add a new property to an object from an array of objects in Javascript
I am trying to add a new property to an object which is part of an array of objects.
The main array looks like this:
0: {key: 'Fruits', props: Array(22)}
1: {key: 'Dried', props: Array(1)}
2: {key: 'F...
marincean adrian
Votes: 0
Answers: 1
In Haskell, does mutability always have to be reflected in type system?
I'm new to Haskell, so please forgive if this question is dumb.
Imagine that we have two data structures bound to the names x and y.
x is mutable.
y is not.
As a matter or principle, does x necessaril...
James Strieter
Votes: 0
Answers: 1