Teaching prolog - after SLD resolution, what else?

Once beyond the SLD algorithm, cuts, and other mechanics, what basic prolog patterns should I cover when teaching?

  • difference lists,
  • iterative deepening,
  • recursion
  • accumulators

what’s not on my list that should be?

1 Like
  • Prolog Unit Tests
  • DCGs for recognition, parsing and generating
  • transitive closure
  • File system interaction predicates and setup_call_cleanup/3
  • The difference between single quote, double quote and backtick. See: What type is a single quoted string?
  • How to use SWISH
  • Some items from the Nice to know category might be of value
  • Some items from the Wiki category might be of value
  • Flags
  • That Edinburgh-style I/O is no longer popular.
  • That read_term/2 is not the reading of console input that they might think. I prefer read_string/5
  • How to work with facts vs how to work with items in a list, e.g. Finding all Solutions to a Goal
  • Failure driven loop
  • double negation
  • guard statements
  • write_canonical/2
  • How to generate holes for values then fill the holes, e.g. generate a list of holes using length/2 then fill the holes. As you know this is useful with iterative deepening, but many beginners don’t know the concept can be expanded beyond that, e.g. trees.
  • Understanding pure and defaulty and other terminology that is more commonly only known with logic programming.
2 Likes

those are great.

1 Like