Question: DEFINE A FUNCTION IN the RACKET LANGUAGE: Define a function that takes a list as an argument. It should return a boolean (ie. #t or

DEFINE A FUNCTION IN the RACKET LANGUAGE:

DEFINE A FUNCTION IN the RACKET LANGUAGE: Define a function that takes

Define a function that takes a list as an argument. It should return a boolean (ie. #t or #fl indicating whether the list is sorted in ascending order. You may not use the built-in sorted? function. Your implementation must be recursive. Input: A list of elements of homogenous data type, either numbers or strings. Output: A boolean value that indicates whether the elements of the list are sorted in strictly increasing order. If the list contains heterogenous data types, then throw an error (using the error function) with the message "ERROR: List contains heterogenous data types". Example: >(my-sorted?'(2 5 6 9 11 34)) #t >(my-sorted?'(7 25 415 11 34)) #f > (my-sorted?'("alpha" "beta" "gamma")) #t > (my-sorted? '("john" "zack" "bob")) #f > (my-sorted?'(7 "spam" 9)) ERROR: List contains heterogenous data types Define a function that takes a list as an argument. It should return a boolean (ie. #t or #fl indicating whether the list is sorted in ascending order. You may not use the built-in sorted? function. Your implementation must be recursive. Input: A list of elements of homogenous data type, either numbers or strings. Output: A boolean value that indicates whether the elements of the list are sorted in strictly increasing order. If the list contains heterogenous data types, then throw an error (using the error function) with the message "ERROR: List contains heterogenous data types". Example: >(my-sorted?'(2 5 6 9 11 34)) #t >(my-sorted?'(7 25 415 11 34)) #f > (my-sorted?'("alpha" "beta" "gamma")) #t > (my-sorted? '("john" "zack" "bob")) #f > (my-sorted?'(7 "spam" 9)) ERROR: List contains heterogenous data types

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!