4 ms·
Minor nitpick: prolog uses unification not pattern matching which is more general because it can handle unbound variables. Major nitpick: declarative thinking
by cconroy 10y ago
Minor nitpick: prolog uses unification not pattern matching which is more general because it can handle unbound variables.
Major nitpick: declarative thinking becomes the dominant way of thinking not pattern matching. When you write prolog declaratively (w/o cuts at the expense of efficiency) your code can answer multiple questions/queries.
- bpyne 10y agoThanks for the clarifications. I learned Prolog over a few weeks for a class I took a year ago. It left a favorable impression on me. With respect to answering "multiple questions/queries", is it fair to draw a parallel with SQL?
- qwertyuiop924 10y agoYes, yes it is. In fact, Picolisp's builtin database uses a built in prolog dialect as its query language.
- cconroy 10y agoI don't think so. Sql is declarative though and the engine does the imperative work for you. A simple example of multiple uses: Simpsons = ['bart', 'lisa', 'homer'], member(X, Simpsons)? will do a for each over the list, with X bound to each character. and the same member definition can also be used to answer Simpsons = ['bart', 'lisa', 'homer'], member('brian griffin', Simpsons)?