concept standard library in category functional programming

This is an excerpt from Manning's book Grokking Functional Programming.
Java
Scala
List<String> rankedWords(Function<String, Integer> wordScore,List<String> words) {Comparator<String> wordComparator =(w1, w2) -> Integer.compare(wordScore.apply(w2),wordScore.apply(w1));return words.stream().sorted(wordComparator).collect(Collectors.toList());}def rankedWords(wordScore: String => Int,words: List[String]): List[String] = {words.sortBy(wordScore).reverse}Requirement #1 Rank the words by the number of letters different than 'a ‘
static int score(String word) {return word.replaceAll("a", "").length();}rankedWords(w -> score(w), words);→ [haskell, rust, scala, java, ada]def score(word: String): Int =word.replaceAll("a", "").lengthrankedWords(score, words);→ List("haskell", "rust", "scala", "java", "ada")Requirement #2 Additionally, if a word contains a letter 'c', it gets bonus 5 points
static int scoreWithBonus(String word) {int base = score(word);if (word.contains("c"))return base + 5elsereturn base;}rankedWords(w -> scoreWithBonus(w), words);→ [scala, haskell, rust, java, ada]def scoreWithBonus(word: String): Int = {val base = score(word)if (word.contains("c")) base + 5 else base}rankedWords(scoreWithBonus, words);→ List("scala", "haskell", "rust", "java", "ada")
// Note that we still don’t have a fully functional solution to the problem. We are just comparing the signatures and usages to give you an intuition how Option-based differs from exception-based.

This is an excerpt from Manning's book Functional Programming in C++.
I’ve always been amused that most developers say C++ is an object-oriented language. The reason this is amusing is that barely any parts of the standard library of the C++ programming language (commonly referred to as the Standard Template Library, or STL) use inheritance-based polymorphism, which is at the heart of the OOP paradigm.
First, it relies on
Tbeing default-constructible. Although all collections in the standard library have default constructors, it’s not difficult to imagine a collection-like structure that doesn’t. For example, you can see the previously mentionedexpected<T,E>as a collection that contains zero or one value of typeT. And it doesn’t have a default constructor. If you want an emptyexpected<T, E>, you’ll need to specify the error explaining why it’s empty.