жопу?
[<AutoOpen>]
module Append2
=
type Append2
=
Append2
with
static member inline (?<-) ( lst : 'a array
, _Blank : Append2
, _ : 'a array )
=
fun fst -> Array.append fst lst : 'a array
static member inline (?<-) ( lst : 'a list
, _Blank : Append2
, _ : 'a list )
=
fun fst -> List.append fst lst : 'a list
let inline Append2 (fst :'a) lst :'a
=
(lst ? (Append2) <- Unchecked.defaultof<'a>) fst
Append2 [1..3] [27..30]
|> printfn "%A"
//=> [1; 2; 3; 27; 28; 29; 30]
Append2 [|1..3|] [|27..30|]
|> printfn "%A"
//=> [|1; 2; 3; 27; 28; 29; 30|]
https://sharplab.io/#v2:DYLgZgzgNALiBOBXAdlAJiA1AHwNoB4BBRGAewHkAHAU2QD4BdAWACgBbUtRYagAl8KUayNACZWAXlb8YATxr9BwsdP5r+UluvVLaKrdv4B3AJYwAFqsMQYAQxgmAxvzbU2AI2rx+J5MF98ABQA/PgAtACU/IFqwDbqILwA5La8tvDwtrJWhrl5+blQvAD6AELAtsgA1ryJAkJ64gYFLa3aRcWGiSlpGVn8ETmtErxDLWAovJAwvGF0An2yAHS2DSJT8XEztcmp6ZnZzW2jR+o29k4ubp7evL7+yEGhkdGx8Wrdqf42Y8d/7SVypUanVdCImv9IYUSl1drxvtteINTi0Rr98hNkBsZnNeAAZEw2FZrND8abw96feGEmCqVQ8RH3AKKEmiXiBckgFJRLa1FLovKaf6BXnBdlgsRRcK8ACqyEc5mojiq1DQSzQ1DAtm4ZDA+BSdCi01YrAlbNwAEYlksAMwMXi4UQAdmtNoADMwWNh5rxKPBfDAwFiAEQAUkIwdYAHooxJ5paANy8URJm1J53pgAc6YAnKmPSaWGaHdgrbbsPbcNhna63RXWN7+H6A0HeGGI9HY/HS+nU+mnVnc/mK0A==
Нажми «отформатировать код» пож 🌚
ща в фантомасе сделаю
[<AutoOpen>] module Append2 = type Append2 = Append2 with static member inline (?<-)(lst: 'a array, _Blank: Append2, _: 'a array) = fun fst -> Array.append fst lst: 'a array static member inline (?<-)(lst: 'a list, _Blank: Append2, _: 'a list) = fun fst -> List.append fst lst: 'a list let inline Append2 (fst: 'a) lst : 'a = (lst?(Append2) <- Unchecked.defaultof<'a>) fst Append2 [ 1..3 ] [ 27..30 ] |> printfn "%A" //=> [1; 2; 3; 27; 28; 29; 30] Append2 [| 1..3 |] [| 27..30 |] |> printfn "%A" //=> [|1; 2; 3; 27; 28; 29; 30|] https://sharplab.io/#v2:DYLgZgzgNALiBOBXAdlAJiA1AHwNoB4BBRGAewHkAHAU2QD4BdAWACgBbUtRYagAkMo1kaAEy8AvK17TeMAJ41+g2qIlKhoqTO0B3AJYwAFqy3azvCDACGMPQGNebamwBG1eLz3JgXvgAoAfnwAWgBKP2BLEF4AciteK3h4KzkoXgB9ACFgK2QAa2iBDRE09Oi4hKSU0IlTc3qwFF5IGF5gun4quQA6K2VhZsteSLhY+MTkuRMWerNLG3tHZzcPLx9kfyCwiKix4b1LUuzcgvUVEozy+J9LGskZ2YamlraOgBkDmF7+tEHWkau+0s020PFaa18Z2EYj8LSuNRGvEB91mOxgAT8RXONRCvAAqsg7IZqHY8tQ0N00NQwFZuGQwPg4nQai1pljobxcLwAIzdboAZl4DE5vBEAHY+fyAAxC3jYDqUeBeGBgZC8ABEAFJCOrWAB6PXiDq4bkAblF5v55vF1oAHNaAJyWqXMFisdmqXDYHmSuXCr2iiUCmXYYXy3iK5WqjXa3UsA1GznYM0W3hWwN2x3O0OsIA
я не знаю как такое читать если честно (мазохизм какой-то)
а оно ещё и вот так работает: [<AutoOpen>] module Append2 = type Append2 = Append2 with static member inline (?<-)(lst: 'a array, _Blank: Append2, _: 'a array) = fun fst -> Array.append fst lst: 'a array static member inline (?<-)(lst: 'a list, _Blank: Append2, _: 'a list) = fun fst -> List.append fst lst: 'a list let inline Append2 fst lst = (lst?(Append2) <- Unchecked.defaultof<'a>) fst Append2 [ 1..3 ] [ 27..30 ] |> printfn "%A" //=> [1; 2; 3; 27; 28; 29; 30] Append2 [| 1..3 |] [| 27..30 |] |> printfn "%A" //=> [|1; 2; 3; 27; 28; 29; 30|]
Обсуждают сегодня