How to set value to `Item` of struct using F# -


how set value item of struct? have tried following 2 types both end value must mutable error.

module test1 =   [<struct>]   type test (array: float []) =     member o.item       = array.[i]       , set value = array.[i] <- value    let test = test [|0.0|]   test.[0] <- 4.0  module test2 =    [<struct>]   type test =     val mutable array: float []     new (array: float []) = { array = array }     member o.item       = o.array.[i]       , set value = o.array.[i] <- value    let test = test [|0.0|]   test.[0] <- 4.0 

please try replace:

 let test = test [|0.0|] 

with:

 let mutable test = test [|0.0|] 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -