Study resource
Functional programming paradigm common mistakes
Study Functional programming paradigm with curriculum-aligned Common Mistakes resources, practice links, and exam-focused support.
At a glance
common mistakes
Resource type
Topic
Functional programming paradigm
Common mistakes
Assuming every co-domain member must be an output
Treating the co-domain as the exact set of values that the function produces.
Fix itThe co-domain is the set from which outputs are chosen. It may contain members that the function never uses.
Assuming first-class objects are only functions
Treating the phrase first-class object as meaning that only functions can have first-class status.
Fix itFunctions can be first-class objects, but the specification also gives integers, floating-point values, characters and strings as examples of first-class values in many programming languages.
Treating the inputs as unrelated arguments
Saying that a function with type integer x integer → integer takes two arguments in fact.
Fix itAlthough it is commonly described as taking two arguments, it takes one argument: a pair of integers such as (3,4).
Treating a partially applied function as the final result
Assuming that add 4 is an integer result.
Fix itRecognise that add 4 is a function of type integer → integer. It needs another integer before the final integer result is produced.
Applying the functions in the wrong order
Treating g ○ f as though g is applied first and f is applied second.
Fix itApply the function nearest the input first. For g ○ f, apply f first, then apply g to the result.
Related topics
