Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pipeline pow operator issue with

Tags:

.net

f#

i want to write the next function using pipeline:

A = 1/Sum[1-k](x^2)

so when i write:

//Adaptive step
let a_Adaptive x =
    x
    |> Array.map (fun x -> x ** 2.0)
    |> Array.sum
    |> (**) -1.0

f# interpretes (**) as a multiline comment, but i want use it as a function. Any suggestions?

like image 980
Dzmitry Martavoi Avatar asked Sep 22 '13 16:09

Dzmitry Martavoi


People also ask

What happened to the Nordstrom pipeline?

On Sept. 26, a flurry of detonations on two underwater pipelines connecting Russia to Germany sent gas spewing to the surface of the Baltic Sea. The explosions triggered four gas leaks at four locations — two in Denmark's exclusive economic zone and two in Sweden's exclusive economic zone.

Who damaged the Nord Stream pipeline?

Russia's defence ministry said on Saturday that British navy personnel blew up the Nord Stream gas pipelines, a claim that London said was false. Sweden and Denmark have both concluded that four leaks on Nord Stream 1 and 2 were caused by explosions, but have not said who might be responsible.

What are pipeline operators?

A pipeline operator—also known as a pump operator, gauger or gas operator—is a technical professional who controls the flow of gas, oil and other materials through pipelines.

Who owns Nord Stream 2 pipeline?

It is operated by Nord Stream AG. Nord Stream 2 (NS2) runs from Ust-Luga in northwestern Russia near Estonia. The pipeline was built in order to increase gas exports towards Europe, aiming to double annual capacity. The project was completed in 2021, but has not yet entered service.

Was Nord Stream 2 ever operational?

The construction of the pipeline started in 2011, to expand the Nord Stream 1 line and double annual capacity to 110 billion cubic metres (3.9 trillion cubic feet). It was completed in September 2021, but has not yet entered service.


1 Answers

You just need to add a space before the **:

let a_Adaptive x =
    x
    |> Array.map (fun x -> x ** 2.0)
    |> Array.sum
    |> ( ** ) -1.0

From the F# specification:

To define other operators that begin with *, whitespace must follow the opening parenthesis; otherwise (* is interpreted as the start of a comment:

let ( *+* ) x y = (x + y)

like image 169
Lee Avatar answered Sep 30 '22 08:09

Lee