RosettaCodeData/Task/Call-a-function/WDTE/call-a-function.wdte

21 lines
589 B
WDTE

let noargs => + 2 5;
noargs -- print;
let fixedargs a b => + a b;
fixedargs 3 5 -- print;
let m => import 'math';
m.cos 3 -- print;
# WDTE only has expressions, not statements, so statement vs.
# first-class context doesn't make sense.
# Arguments in WDTE are technically passed by reference, in a way, but
# because it's a functional language and everything's immutable
# there's no real usability difference from that.
# Partial application is possible. For example, the following
# evaluates `+ 3` and then passes 7 to the resulting partially applied
# function.
(+ 3) 7 -- print;