Call a function: Difference between revisions

Content added Content deleted
(→‎{{header|Déjà Vu}}: Fixes example)
(→‎{{header|Déjà Vu}}: Fixes example)
Line 316: Line 316:


=={{header|Déjà Vu}}==
=={{header|Déjà Vu}}==
<lang dejavu># all functions except foo are from the standard library
<lang dejavu># all functions used are from the standard library
# calling a function with no arguments:
# calling a function with no arguments:
random-int
random-int
Line 323: Line 323:
# calling a function with optional arguments:
# calling a function with optional arguments:
# optional arguments are not really possible as such
# optional arguments are not really possible as such
# generally differently named functions are used:
# strategies are:
# 1) differently named functions:
sort [ 3 2 1 ]
sort [ 3 2 1 ]
sort-by @len [ "Hello" "World" "Bob" ]
sort-by @len [ "Hello" "World" "Bob" ]
# 2) differentiate by value of other arguments:
foo ?????????????????????????????????????????????????????
# calling a function with a variable number of arguments:
# calling a function with a variable number of arguments:
# generally with a special terminator value, which one depends
# generally with a special terminator value, which one depends
Line 349: Line 346:
# arguments are passed by object-identity, like in Python and Lua
# arguments are passed by object-identity, like in Python and Lua
# partial application is not possible, due to the fact that
# partial application is not possible, due to the fact that
# a function's arity is a property of it's behavior and not
# a function's arity is a property of its behavior and not
# of it's definition</lang>
# of its definition</lang>


=={{header|Erlang}}==
=={{header|Erlang}}==