Niles C.

asked • 10/09/24

How can I write function `listmatch/3` that counts how many words in a list match some pattern in SWI-Prolog?

How can I write function `listmatch/3` that counts how many words in a list match some pattern? The list is the first argument, the pattern is the second, and the result is the third.


My teacher said he need three clauses and two cuts. I am immensely struggling to find a way to do it effectively in SWI-Prolog.

Paul E.

tutor
What is the format of the pattern? Regular expression?
Report

10/10/24

1 Expert Answer

By:

Blaise Ayim T. answered • 10/15/24

Tutor
New to Wyzant

Software Engineer & Bilingual Tutor | Coding, French, and English

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.