TransformedOperation function

Warning

This documentation refers to the Classic QDK, which has been replaced by the Modern QDK.

Please see https://aka.ms/qdk.api for the API documentation for the Modern QDK.

Namespace: Microsoft.Quantum.Canon

Package: Microsoft.Quantum.Standard

Given a function and an operation, returns a new operation whose input is transformed by the given function.

function TransformedOperation<'T, 'U> (fn : ('U -> 'T), op : ('T => Unit)) : ('U => Unit)

Input

fn : 'U -> 'T

A function that transforms the given input into a form expected by the operation.

op : 'T => Unit

The operation to be transformed.

Output : 'U => Unit

A new operation that calls fn with its input, then passes the resulting output to op.

Type Parameters

'T

'U

Example

The following call uses LittleEndianAsBigEndian function to transform an operation designed for BigEndian user defined type inputs into an operation that accepts inputs of type LittleEndian user defined type:

let leOp = TransformedOperation(LittleEndianAsBigEndian, ApplyXorInPlaceBE);

See Also