WOLFRAM

OperationDeclaration
OperationDeclaration

New in 14.1[Experimental]

OperationDeclaration[type,op,typedfun]

declares a typed function to be used for the operation op of type.

Details

Examples

Basic Examples  (1)Summary of the most common use cases

A declaration of a product type with one operation:

A declaration of the operation:

Compile a function to create an instance of the type and another to call the "Increment" operation:

Out[3]=3

Create the instance:

Call the "Increment" operation; the old value of 0 is returned:

Out[5]=5

Call the "Increment" operation again; now the old value is 1:

Out[6]=6
Wolfram Research (2024), OperationDeclaration, Wolfram Language function, https://reference.wolfram.com/language/ref/OperationDeclaration.html.
Wolfram Research (2024), OperationDeclaration, Wolfram Language function, https://reference.wolfram.com/language/ref/OperationDeclaration.html.

Text

Wolfram Research (2024), OperationDeclaration, Wolfram Language function, https://reference.wolfram.com/language/ref/OperationDeclaration.html.

Wolfram Research (2024), OperationDeclaration, Wolfram Language function, https://reference.wolfram.com/language/ref/OperationDeclaration.html.

CMS

Wolfram Language. 2024. "OperationDeclaration." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/OperationDeclaration.html.

Wolfram Language. 2024. "OperationDeclaration." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/OperationDeclaration.html.

APA

Wolfram Language. (2024). OperationDeclaration. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/OperationDeclaration.html

Wolfram Language. (2024). OperationDeclaration. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/OperationDeclaration.html

BibTeX

@misc{reference.wolfram_2025_operationdeclaration, author="Wolfram Research", title="{OperationDeclaration}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/OperationDeclaration.html}", note=[Accessed: 19-June-2025 ]}

@misc{reference.wolfram_2025_operationdeclaration, author="Wolfram Research", title="{OperationDeclaration}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/OperationDeclaration.html}", note=[Accessed: 19-June-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_operationdeclaration, organization={Wolfram Research}, title={OperationDeclaration}, year={2024}, url={https://reference.wolfram.com/language/ref/OperationDeclaration.html}, note=[Accessed: 19-June-2025 ]}

@online{reference.wolfram_2025_operationdeclaration, organization={Wolfram Research}, title={OperationDeclaration}, year={2024}, url={https://reference.wolfram.com/language/ref/OperationDeclaration.html}, note=[Accessed: 19-June-2025 ]}