Implicit parameters are extra help that a function gets without being asked, kind of like a sneaky friend who shows up to help you finish your homework.
Imagine you're playing with building blocks, and you have a robot friend named Bob. When you tell Bob to stack blocks, he automatically knows how high to stack them, even though you didn’t say anything about the height. That’s because Bob has hidden instructions, he was given extra help that lets him do his job better.
How it works
Think of a function as someone who does a task for you. Sometimes, they need extra help to get the job done. These helps are called implicit parameters, and they're passed in without you needing to say anything about them.
For example, when you write a letter, you don’t have to tell your pen how hard to press, it just knows. The pen gets its own kind of hidden help to do the job well.
Examples
- In a game, if a character always knows where you are, that position is passed as an implicit parameter.
Ask a question
See also
- What is recursion?
- What are tagged unions?
- What are recursive calls?
- What are persistent data structures?
- What on Earth is Recursion? - Computerphile?