Hav not find a method or func to join arrays, and the "@" and "+" operator not works
is there any simple func or operator to do this
like in js [...array1, element1, elment2]
given
let a = [|1;2;3|]
let b = [|2;3;4|]
want
let c = [|1;2;3;4|]
let d = [|1;2;3;2;3;4|]
Depending on what you do arrays might be the wrong data structure for your case if find yourself appending a lot.
Array comprehension syntax gives a similar experience, yield! yields the array, and single element can be used in place.
[| yield! a; 4] = [| 1; 2; 3; 4|]
[| yield! a; yield! b |] = [|1; 2; 3; 2; 3; 4|]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With