Call a function: Difference between revisions

Content added Content deleted
(J draft)
Line 18: Line 18:
=={{header|J}}==
=={{header|J}}==


''A function that requires no arguments'' can be simulated by calling a function with an empty list of arguments: <lang j>f''</lang>
''A function that requires no arguments'' can be simulated by calling a function with an empty list for an argument: <lang j>f''</lang>


''A function with a fixed number of arguments'' gets special treatment in J when the fixed number is 1 or 2. <lang j>f 'one argument'</lang>and <lang j>'this example has two arguments' f 'the other argument'</lang> Alternatively, you can add something that enforces a constraint on length for the varargs case.
''A function with a fixed number of arguments'' gets special treatment in J when the fixed number is 1 or 2. <lang j>f 'one argument'</lang>and <lang j>'this example has two arguments' f 'the other argument'</lang> Alternatively, you can add something that enforces a constraint on length for the varargs case.