Questions tagged [mutation]

Mutation refers to a genetic operator used to maintain genetic diversity from one generation of a population to the next. For javascript DOM, use [mutation-observers]. For Java mutators, use [mutators]. For object mutability in general, use [mutability].

557 questions
23
votes
2 answers

GraphQL error: Cannot query field 'mutation_name' on type 'Mutation'

I am trying to mutate a mutation. The mutation does exist and works fine on my graphql playground. but as I implement it in my react component, I get error. Queries work fine though. By the way, I need client in my code so I definitely have to use…
Anita
  • 476
  • 3
  • 10
  • 24
16
votes
3 answers

Replace array item with another one without mutating state

This is how example of my state looks: const INITIAL_STATE = { contents: [ {}, {}, {}, etc.. ], meta: {} } I need to be able and somehow replace an item inside contents array knowing its index, I have tried: return { ...state, …
Ilja
  • 44,142
  • 92
  • 275
  • 498
15
votes
5 answers

applying crossover and mutation to a graph (genetic algorithm)

I'm playing arround with a Genetic Algorithm in which I want to evolve graphs. Do you know a way to apply crossover and mutation when the chromosomes are graphs? Or am I missing a coding for the graphs that let me apply "regular" crossover and…
Manuel Araoz
  • 15,962
  • 24
  • 71
  • 95
14
votes
0 answers

How to calculate the number of mutants in a quite simple Fortran-77 Program

Next week I will make a presentation about mutation test in my class. The professor give me the paper An Experimental Determination of Sufficient Mutant Operators, written by A. Jefferson Offutt et.al. From the paper, I can get a conclusion that the…
machinarium
  • 631
  • 6
  • 17
14
votes
6 answers

Remove data from nested objects without mutating

Is there any elegant way of removing an object from an array which is part of an array? I have been working with React and Redux for a while now but get stuck several hours everytime I have to remove or insert data without mutating the state. The…
Daniel Storch
  • 979
  • 3
  • 10
  • 25
13
votes
2 answers

How to pass variables in mutation graphQL Playground?

I am using apollo express server 2.0. And I am trying to execute mutation in the graphql playground. Here is the mutation I have attached a screenshot with another screenshot of a variable. I am getting the following error when I am trying to…
Piyush Bansal
  • 1,635
  • 4
  • 16
  • 39
12
votes
3 answers

Why do we need to avoid mutations while coding? What is a mutation?

Why is the second code (the one with the stream) a better solution than the first? First : public static void main(String [] args) { List values = Arrays.asList(1,2,3,4,5,6); int total = 0; for(int e : values) { total += e *…
codeme
  • 861
  • 2
  • 12
  • 29
11
votes
2 answers

Vuex/Vuejs: accessing localStorage within vuex store

I am using localStorage to set and get items, which is placed within my javascript code in a .vue file. However, I would like to somehow access that storage and place it within my Vuex store section which is in another file, most preferably within…
Aadil Hafesji
  • 383
  • 2
  • 7
  • 23
11
votes
1 answer

PTTest is failing and not generating mutation coverage

I want to generate mutation test coverage. I am doing POC on PI Test but it is not taking my test classes and failing. I have configured PTTest plugin in pom.xml. I checked the target class package name and target test class package name are correct…
Prithvipal Singh
  • 511
  • 4
  • 9
  • 23
10
votes
1 answer

How do I save and change the value of a variable in OCaml?

This may be a very newbie question, but I didn't find the answer. I need to store, for example a list and later replace it with another, under the same pointer.
EBM
  • 1,067
  • 2
  • 11
  • 20
9
votes
3 answers

Mutate across multiple columns to create new variable sets

I have a panel dataset at the country and year level, and I'd like to create a two new variables based on existing ones. year country var1 var2 var3 var…
PierreRoubaix
  • 167
  • 1
  • 1
  • 7
9
votes
5 answers

React query mutation: getting the response from the server with onError callback when the API call fails

I am working on a React JS project. In my project, I am using React query, https://react-query.tanstack.com/docs/guides/mutations. I am using mutation to make the post request to the server. But I am trying the get the response returns from the…
Wai Yan Hein
  • 13,651
  • 35
  • 180
  • 372
9
votes
3 answers

Python difference between mutating and re-assigning a list ( _list = and _list[:] = )

So I frequently write code following a pattern like this: _list = list(range(10)) # Or whatever _list = [some_function(x) for x in _list] _list = [some_other_function(x) for x in _list] etc I saw now on a different question a comment that explained…
Neil
  • 3,020
  • 4
  • 25
  • 48
8
votes
1 answer

React RTK query Mutation can return value?

Is is possible to get the response of endpoint in React RTK Query Mutation . I have a one mutation which insert into DB and I need to get the ID which inserted. in my api : addRecord: build.mutation({ query(data) { return { …
Reza Rahgozar
  • 99
  • 1
  • 7
8
votes
2 answers

vuex unknown local mutation type: updateValue, global type: app/updateValue. Mutations don't work

I want to apply mutations through actions to a variable in my vuejs application. But I get this error saying [vuex] unknown local mutation type: updateValue, global type: app/updateValue Here is my store folder structure: -store -modules …
seyet
  • 1,080
  • 4
  • 23
  • 42
1
2 3
37 38