What is a predicate?

前端 未结 12 1717
无人及你
无人及你 2020-12-04 12:16

Being a hobbyist coder, I\'m lacking some fundamental knowledge. For the last couple days I\'ve been reading some stuff and the word \"predicate\" keeps reappearing. I\'d ve

12条回答
  •  攒了一身酷
    2020-12-04 12:25

    It is probably useful to consider the grammatical meaning of the concept to extrapolate the programming concept.

    From wikipedia:

    In traditional grammar, a predicate is one of the two main parts of a sentence (the other being the subject, which the predicate modifies). For the simple sentence "John [is yellow]," John acts as the subject, and is yellow acts as the predicate, a subsequent description of the subject headed with a verb.

    In current linguistic semantics, a predicate is an expression that can be true of something. Thus, the expressions "is yellow" or "is like broccoli" are true of those things that are yellow or like broccoli, respectively. This notion is closely related to the notion of a predicate in formal logic, which includes more expressions than the former one, like, for example, nouns and some kinds of adjectives.

    In logic terms:

    An operator in logic which returns either true or false.

    from MathWorld

提交回复
热议问题