Skip to main content

Questions tagged [immutability]

Immutability is the inability to modify data after it has been created. Modifications are instead made by copying the data. A property of immutable data is that it is *referentially transparent*.

6 votes
1 answer
932 views

I implemented a function that gets an object and returns its immutable counterpart. If the object contains another mutable object at any level, it freezes it too. Is my code is good and/or can it be ...
Marco Sulla's user avatar
4 votes
1 answer
135 views

I implement a working version of the Lift Kata Can you provide me some tips to improve my code? I am not very proud of the handleLiftWithOpenDoors method that have ...
fluminis's user avatar
  • 196
3 votes
1 answer
272 views

There are frozenset in Python, but no frozendict or frozenmap. I tried to implement it (Don'...
Mechanic Pig's user avatar
2 votes
1 answer
131 views

I am writing an immutable interpreter in C++ for fun. Originally standard vectors and dequeues were used to create a double ended queue data type, but it was very slow, because each operation require ...
StormCrow's user avatar
  • 369
2 votes
1 answer
356 views

I implemented an immutable hash map in C, as described in this paper. First, my design goals: plug-and-playable: compile with gcc -O3 -std=c11 champ.c, ...
ammut's user avatar
  • 161
2 votes
0 answers
36 views

I'd like to know there's a better code than I did. interface AnswerProps{ itemId: string; value: Array<string> } This code works like checkbox. If <...
kyun's user avatar
  • 121
8 votes
2 answers
389 views

There aren't enough questions about creating immutable objects... so why not try it again with another approach. This time, it's a builder that maps properties to constructor parameters. Properties ...
t3chb0t's user avatar
  • 44.7k
7 votes
1 answer
240 views

Update: further succinct versions below (inspired by Haskell) Quick sort in JS assuming an immutable array: ...
coder_bro's user avatar
  • 419

15 30 50 per page
1
2 3 4 5 6