Task

Demonstrate the different syntax and semantics provided for calling a function.



This may include:

   Calling a function that requires no arguments
   Calling a function with a fixed number of arguments
   Calling a function with optional arguments
   Calling a function with a variable number of arguments
   Calling a function with named arguments
   Using a function in statement context
   Using a function in first-class context within an expression
   Obtaining the return value of a function
   Distinguishing built-in functions and user-defined functions
   Distinguishing subroutines and functions
   Stating whether arguments are passed by value or by reference
   Is partial application possible and how


This task is not about defining functions.




// function with no arguments
no_args()
 
// function with fixed amount of arguments
three_args(a, b, c)
 
// nanoquery does not support optional, variable, or named arguments
 
// obtaining a return value
value = returns_value()
 
// checking if a function called "func" is user-defined
try
        type(func)
        println "func is user-defined"
catch
        println "func is a built-in or doesn't exist"
end