A simple predicate for outputting the elements of a list, and a search-tree explanation of how the program works in practice. Gives a review in Prolog's matching and search processes.
0:00 Review of Prolog's search & matching
0:36 write_list/1 specification
1:14 the empty list [] (base case)
1:26 step case, using [H|T] to describe "non-empty list"
1:42 the rule using [H|T] is a recursive, step case
2:08 example of search for list of length 3
3:26 the empty list doesn't match step case
3:46 matching succeeds with clause 2
Soundtrack: Seriously Future, by Yarin Primak
under license from artlist.io
https://artlist.io/song/60259/seriously-future
► Support the channel
Like: Give a 👍 to this video (thanks!)
Subscribe: https://www.youtube.com/c/abitofintelligence/?sub_confirmation=1
Download
0 formats
No download links available.
List Processing in Prolog (a search and matching example) | NatokHD