subject

Define the following Prolog predicates:

(a) increasing(List) which is true if List is a monotonically increasing list of numbers (e. g. [1,1,3,4,5,5,5,7])

(b) decreasing(List) which is true if List is a monotonically decreasing list of numbers (e. g. [7,7,5,5,3,2,1,1]

(c) sorted(List) which is true if List is sorted (increasingly or decreasingly)

(d) analyze(List) which displays the message ‘This list is sorted’, or ‘This list is not sorted’ depending on the values in the list.

(e) minplusmax(List, MinPlusMax) which returns the sum of the minimum and the maximum element of the List

Notes: (1) Performance of these predicates is not critical (all reasonable solutions are OK); (2) monotonically increasing means that each value is less than or equal to the next value ; (3) in definitions of new predicates, you may use your previously defined predicates.

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 15:40, qhenley
Most networking media send data using in which data is represented by only two discrete states: 0s and 1s. a. digital signals b. contiguous signals c. ramp signals d. exponential signals
Answers: 1
image
Computers and Technology, 23.06.2019 06:30, QueeeenUknown7437
How do you write an argumentative essay about the importance of free enterprise ?
Answers: 1
image
Computers and Technology, 23.06.2019 09:00, 19youngr
Which company provides a crowdsourcing platform for corporate research and development? a: mtruk b: wiki answers c: mediawiki d: innocentive
Answers: 2
image
Computers and Technology, 23.06.2019 20:50, terryhgivens5349
3.11.3 quiz: comparing and analyzing function typesquestion 4 of 102 pointswhat can you say about the y-values of the two functions f(x) = 3x2-3 andg(x)=2* - 3?
Answers: 2
You know the right answer?
Define the following Prolog predicates:

(a) increasing(List) which is true if List is a...

Questions in other subjects:

Konu
Mathematics, 25.07.2020 14:01