Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem Description Prolog Lab Exercise #1 Submit to Canvas a file with Prolog clauses such that Amtoft 1. 2- sum list(L,S) with L a ground

image text in transcribed
Problem Description Prolog Lab Exercise #1 Submit to Canvas a file with Prolog clauses such that Amtoft 1. 2- sum list(L,S) with L a ground list, returns inS the sum of the elements in L. For example: ?. sum-list([4,3,1,9],S) must return S = 17. 2. ?- sum sublist (L,S) with L a ground list, returns in S the sum of any sublist of L. For example: ?- sum sublist ([4,3],.S) must return (in any order) four answers: S = 0; S = 3: S = 4; S = 7. 3. ?- pick even(L,E) returns true if E is the list formed from the even positions in L. This predicate must be applicable in both directions: ?-pick-even(5,3, 1,7],E) must return E = [3,7]. ?-pick-even(L,[4,7]) must return (in any order; the variables-1,-2, etc may be renamed) two answers: L-|-1, 4,27];1,4,-2, 7,-3] For arithmetic, Prolog uses is, as in X is Z +Y

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Managing Your Information How To Design And Create A Textual Database On Your Microcomputer

Authors: Tenopir, Carol, Lundeen, Gerald

1st Edition

1555700233, 9781555700232

More Books

Students also viewed these Databases questions