4
$\begingroup$

For example, if I've defined the operation PlusEqual, I'd like to say

operation MinusEqual = Adjoint PlusEqual;

but this produces a syntax error.

Is the only way to do this by exhaustively re-listing all arguments and functors?

operation MinusEqual (all_args_and_types_again) : ReturnType {
    body (...) {
        return Adjoint AddEqual(all_args);
    }
    adjoint auto;
    controlled auto;
    controlled adjoint auto;
}
$\endgroup$

1 Answer 1

4
$\begingroup$

You can define an immutable symbol for MinusEqual inside the body of an operation which will use it (you can't define it globally):

operation UseMinusEqual () : Unit {
    ...
    let MinusEqual = Adjoint PlusEqual;
    MinusEqual(...);
}

If you need MinusEqual to be a globally visible operation, there is no shorthand syntax for this right now, so the only way to do it is a full operation definition like you say.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.