Given the following prolog rules, what will be the result of the query? test( [H_1, H):- number(H), !. % number/1 evaluates to true if argument i test([_IT), S):- test(T, S). ?- test([a, b, 4, d, 3, a(b, c)l, S). O a. S=4 O b. S=3 O c. S= (4, 3] Od. None of the above

CMPTR
3rd Edition
ISBN:9781337681872
Author:PINARD
Publisher:PINARD
Chapter18: Maintaining And Querying A Database
Section: Chapter Questions
Problem 2QY
icon
Related questions
Question

Please help with the followng:

 

Given the following prolog rules, what will be the result of the query?
test( [H_1, H):- number(H), !. % number/1 evaluates to true if argument i
test([_IT), S):- test (T, S).
?- test([a, b, 4, d, 3, a(b, c)l, S).
O a. S=4
O b. S=3
O c. S= (4, 3]
O d. None of the above
Transcribed Image Text:Given the following prolog rules, what will be the result of the query? test( [H_1, H):- number(H), !. % number/1 evaluates to true if argument i test([_IT), S):- test (T, S). ?- test([a, b, 4, d, 3, a(b, c)l, S). O a. S=4 O b. S=3 O c. S= (4, 3] O d. None of the above
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Computational Systems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
CMPTR
CMPTR
Computer Science
ISBN:
9781337681872
Author:
PINARD
Publisher:
Cengage