Call a function: Difference between revisions

Added an ALGOL 68 header and examples.
(Nimrod -> Nim)
(Added an ALGOL 68 header and examples.)
Line 66:
Named := H(Int => A, Fun => F'Access);
Mixed := H(A, Fun=>F'Access); </lang>
 
=={{header|ALGOL 68}}==
<lang algol68># A function without arguments: #
f();
 
# A function with a fixed number of arguments: #
f(1, x);
 
# ALGOL 68 does not support optional arguments, variable numbers of arguments, or named arguments. #
 
# In "Talk:Call a function" a statement context is explained as "The function is used as an instruction (with a void context),
rather than used within an expression." Based on that, both ALGOL examples above are already in a statement context.
For full ALGOL compatibility, though, they should be in the form "VOID (f ());" #
 
# A function's return value being used: #
x := f(y);
 
# There is no distinction between built-in functions and user-defined functions. #
 
# A subroutine is simply a function that returns VOID. #
 
# If the function is declared with argument(s) of mode REF MODE, then those arguments are being passed by reference. #</lang>
 
See [http://rosettacode.org/wiki/First-class_functions#ALGOL_68 First-Class Functions] for an example of first-class functions in ALGOL 68.
 
See [http://rosettacode.org/wiki/Partial_function_application#ALGOL_68 Partial Function Application] for an example of partial function application in ALGOL 68.
 
=={{header|AutoHotkey}}==
Anonymous user