3 ms·
> Prolog came out the same year as C and popularized logic programming, and you can sort of fake assignment with cuts. Can anyone explain to me what this is su
by tom_mellior 9y ago
> Prolog came out the same year as C and popularized logic programming, and you can sort of fake assignment with cuts.
Can anyone explain to me what this is supposed to mean? (I know Prolog, I understand cuts very well. But I don't know what the author means here.)
- hwayne 9y agoIt means I don't understand Prolog very well and really shouldn't have namedropped it :P
- triska 9y agoProlog is a good example of a language where "=" doesn't mean assignment. In Prolog, "=" means unification: You can read X = Y (which is =(X, Y) in functional notation) as: "True iff X and Y are unifiable". You can think of unification as a generalization of pattern matching. For example, f(X, b) is unifiable with f(a, Y) by the substitution {X → a, Y → b}. I think this aspect would be a valuable addition to the article. Fun fact: If (=)/2 were not available as a built-in predicate in Prolog, you could define it by a single fact: X = X. Thus, you do not even need this predicate as a predefined part of the language.