fun with apply
Posted: Wed Aug 27, 2008 11:33 pm
Apply is a fun function it runs a given function with the given arguments.
(apply function argList)
Some uses are saving functions for later use. (like saving the functions in a list to apply them later)
A cool use is working with lists of numbers. Say you wanted the sum of all the numbers in a list all you would have to do is (apply add numberList) and it will return the sum.
(apply function argList)
Some uses are saving functions for later use. (like saving the functions in a list to apply them later)
A cool use is working with lists of numbers. Say you wanted the sum of all the numbers in a list all you would have to do is (apply add numberList) and it will return the sum.