Medium badge

MiniScript Master Public

MiniScript

Demonstrated understanding of advanced MiniScript features, such as function references.

Required Evidence

"Apply" function demo

Create a function that applies some other function to every element of a list. More Info

Badge Overview

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:
  1. Make an apply method that takes a list, and a function, and applies the function to every element of the list.
  2. Create a grocery list ("milk", "eggs", etc.)
  3. Use your apply method to convert every member of your list to upper case, and print the result.
  4. 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.

Badge Experts

Badge Learners