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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:30
How can a user open a blank presentation? 1.on the file menu, click new, and then click recent templates 2.on the file menu, click new, and then click blank presentation 3. on the view menu, click templates, and then click recent templates 4. on the view menu, click samples, and then click blank presentation
Answers: 1
question
Computers and Technology, 23.06.2019 19:00
This question involves a class named textfile that represents a text file. public class textfile { private string filename; private string filename; private arraylist words; // constructors not shown // postcondition: returns the number of bytes in this file public int filesize() { } // precondition: 0 < = index < words.size() // postcondition: removes numwords words from the words arraylist beginning at // index. public void deletewords(int index, int numwords) { } // precondition: 0 < = index < = words.size() // postcondition: adds elements from newwords array to words arraylist beginning // at index. pub lic voidaddwords(int index, string[] newwords) { } // other methods not shown } complete the filesize() method. the filesize() is computed in bytes. in a text file, each character in each word counts as one byte. in addition, there is a space in between each word in the words arraylist, and each of those spaces also counts as one byte. for example, suppose the words arraylist stores the following words: { mary had a little lamb; its fleece was white as snow. } the filesize() method would compute 4 + 3 + 1 + 6 + 5 + 4 + 6 + 3 + 5 + 2 + 5 as the sum of the lengths of each string in the arraylist. the value returned would be this sum plus 10, because there would also be 10 spaces in between the 11 words. complete the filesize() method below: // postcondition: returns the number of bytes in this file public int filesize() { }
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
2. fluorine and chlorine molecules are blamed fora trapping the sun's energyob forming acid rainoc producing smogod destroying ozone molecules
Answers: 2
question
Computers and Technology, 24.06.2019 00:30
Setting up a home network using wireless connections is creating a a. vpn b. lan c. wan d. mini-internet
Answers: 2
You know the right answer?
Define the following Prolog predicates:

(a) increasing(List) which is true if List is a...
Questions
question
English, 26.12.2020 22:30
question
English, 26.12.2020 22:30
question
Arts, 26.12.2020 22:30
question
Mathematics, 26.12.2020 22:30
question
Mathematics, 26.12.2020 22:30
question
Mathematics, 26.12.2020 22:30
Questions on the website: 13722360