Immutable Playground
Immutable persistent data structures playground
var a = ImmutableList.of(0, 1, 2, 3);
var b = a.push(4, 5, 6);
a.toArray(); // -> [0, 1, 2, 3]
b.toArray(); // -> [0, 1, 2, 3, 4, 5, 6]
var a = ImmutableVector.of(0, 1, 2, 3);
var b = a.push(4, 5, 6);
a.toArray(); // -> [0, 1, 2, 3]
b.toArray(); // -> [0, 1, 2, 3, 4, 5, 6]
var a = ImmutableHashMap.of({a: 0, b: 1});
var b = a.set("c", 2);
a.toObject(); // -> {a: 0, b: 1}
b.toObject(); // -> {a: 0, b: 1, c: 2}
var a = ImmutableSet.of(0, 1, 2, 3);
var b = a.set(2, 3, 4);
a.toArray(); // -> [0, 1, 2, 3]
b.toArray(); // -> [0, 1, 2, 3, 4]
var Person = ImmutableRecord({
name: null
}, "Person");
var a = new Person({name: "Bob"});
var b = a.set("name", "Billy");
a.toObject(); // -> {name: "Bob"}
b.toObject(); // -> {name: "Billy"}