17 lines
382 B
Text
17 lines
382 B
Text
1) using an Immediately Invoked Function Expression:
|
|
{{lambda {:x :y} :y :x} hello world}
|
|
-> world hello
|
|
|
|
2) or user defined function
|
|
{def swap {lambda {:x :y} :y :x}}
|
|
-> swap
|
|
|
|
3) applied on words (which can be numbers)
|
|
{swap hello world}
|
|
-> world hello
|
|
|
|
{swap hello brave new world}
|
|
-> brave new hello world
|
|
|
|
{swap {cons hello brave} {cons new world}}
|
|
-> (new world) (hello brave)
|