Despite being a simple, concise language, MiniScript packs some advanced features. One of these is function references — using the @ sign, you can refer to a function without invoking it, allowing you to pass it as an argument to some other function.
To earn this badge, demonstrate understanding of this concept by writing the following program:
- Make an apply method that takes a list, and a function, and applies the function to every element of the list.
- Create a grocery list ("milk", "eggs", etc.)
- Use your apply method to convert every member of your list to upper case, and print the result.
- Now use apply again, but this time with a function defined right at the same time you apply it. Given "milk", this function should return "lots of milk"; given "eggs" it returns "lots of eggs", and so on. Print the result of that.