Skip to content

Latest commit

 

History

History
20 lines (19 loc) · 2.8 KB

94-unpacking-arguments.md

File metadata and controls

20 lines (19 loc) · 2.8 KB

Problem:

You must create a function, spread, that takes a function and a list of arguments to be applied to that function. You must make this function return the result of calling the given function/lambda with the given arguments.

eg:

spread(someFunction, [1, true, "Foo", "bar"] ) 
// is the same as...
someFunction(1, true, "Foo", "bar")
(spread someFunction [1 true "Foo" "bar"] ) 
; is the same as...
(someFunction 1 true "Foo" "bar")
spread someFunction, [1, true, "Foo", "bar"] 
# is the same as...
someFunction 1, true, "Foo", "bar" 
spread(someFunction, [1, true, "Foo", "bar"] ) 
# is the same as...
someFunction(1, true, "Foo", "bar")
spread someFunction, [1, true, "Foo", "bar"] 
# is the same as...
someFunction.(1, true, "Foo", "bar")

Solution