In Scheme, the term "predicate" is used as follows:
A predicate is a procedure that always returns a boolean v开发者_如何学Goalue (#t or #f).
Why does scheme use "predicate" to refer to such a function? And if the usage comes from a previous language, what was the motivation for selecting this term in the first place?
Well, this comes from mathematical logic, as Wikipedia says, predicate is a fundamental concept in first-order logic. In every "implementation" of logic, predicate is a sentence that is either true or false - so it fits into programming languages very well.
精彩评论