I'm trying to figure out the correct syntax to use the pipe operator |> into the creation of an object. Currently I'm using a static member to create the object and just piping to that. Here is the simplified version.
type Shape =
val points : Vector[]
new (points) =
{ points = points; }
static member create(points) =
Shape(points)
static member concat(shapes : Shape list) =
shapes
|> List.map (fun shape -> shape.points)
|> Array.concat
|> Shape.create
What I want to do ...
static member concat(shapes : Shape list) =
shapes
|> List.map (fun shape -> shape.points)
|> Array.concat
|> (new Shape)
Is something like this possible? I don't want to duplicate code by repeating my constructor with the static member create.
Update Constructors are first-class functions as of F# 4.0
In F# 4.0 the correct syntax is.
static member concat(shapes : Shape list) =
shapes
|> List.map (fun shape -> shape.points)
|> Array.concat
|> Shape
The f-word can be a very hurtful, offensive, mean, and/or vulgar word. However, in adults' conversations and certain situations, it can serve as a comic relief, a colorful method of expressing frustration, surprise, astonishment and friendly-exclamation amongst many other things.
A lot of times when we use the dirty words against others, it might be an indication of our frustration level. Abusing or cursing is a unique way to express our anger, desperation or even defeat. This may be still a taboo and certainly considered as a breach of social etiquette.
Historians generally agree that "fuck" hit its stride in the 15th and 16th centuries as a familiar word for sexual intercourse, and from there it evolved into the vulgarity we know today.
Just say more appropriate words rather than the really offensive ones. For example, instead of saying the F word, say, "Flipping" or "Freaking" or "Fudge" or "Frickin", and for the S word, "sugar", "shoot", "shiz", "shingles", "crap" or "crud."
There's always
(fun args -> new Shape(args))
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