OperationDeclaration

OperationDeclaration[type,op,typedfun]

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

Details

Examples

Basic Examples  (1)

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:

Create the instance:

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

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

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.

CMS

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

BibTeX

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

BibLaTeX

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