3 ms·
F# has a similar concept via the with statement. To use your example: type point = { x: int; y:int} let z = {x = 5; y = 10} let y = {z with x = 17
by vishbar 12y ago
F# has a similar concept via the with statement. To use your example:
type point = { x: int; y:int}
let z = {x = 5; y = 10}
let y = {z with x = 17}
- virtualwhys 12y agoInteresting, Scala equivalent is: case class Point(x: Int, y: Int) val p1 = Point(5,10) val p2 = p1.copy(x=17) How does F# handle nested data types? In Scala if you want to copy a case class of a case class (of a case class ...) it can get boilerplate-y as you have to copy outside-in through each property a la: x.copy(acase.copy(bcase.copy(cprop=1)))