Question

16. (10 pts.) Write a Scheme function isneg that will examine an arbitrary list integers and take the value 0 if the list doe
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

Source Code:

def isneg(full_list):
    for num in full_list:
        if num < 0:
            return 'r10'
    return '0'
Let me know if you have any doubts or if you need anything to change. 

If you are satisfied with the solution, please leave a +ve feedback : ) Let me know for any help with any other questions.

Thank You!
===========================================================================
Add a comment
Know the answer?
Add Answer to:
16. (10 pts.) Write a Scheme function isneg that will examine an arbitrary list integers and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • write a Python function that takes in a list of integers and returns maximum and minimum values in the list as a tuple

    1 write a Python function that takes in a list of integers and returns maximum and minimum values in the list as a tuple. Hint (can be done in one pass, you are not allowed to use built-on min and max functions.)max, min = find_max_min(my_list):2 write a Python function that takes in a list of integers (elements), and an integer number (num). The functions should count and return number of integers in elements greater than, less than, and equal to...

  • Use scheme to solve this: MUST USE A COMBINATION OF MAP AND FILTER or MAP AND...

    Use scheme to solve this: MUST USE A COMBINATION OF MAP AND FILTER or MAP AND APPLY: THIS ANSWER IS NOT WHAT I NEED: (define perfect-square-helper (lambda (x y) (if (null? x) (reverse y) (if (integer? (sqrt (car x))) (perfect-square-helper (cdr x) (cons (car x) y)) (perfect-square-helper (cdr x) y))))) (define perfect-square (lambda (x) (perfect-square-helper x '()))) (define x '(1 2 9 16 5 64)) (perfect-square x) Map/Apply/Filter 7. Perfect Squares (10 Points) Using a combination of map, apply and/or...

  • 2. Write a scheme function get-even-nums that accepts a list of numbers and returns a new...

    2. Write a scheme function get-even-nums that accepts a list of numbers and returns a new list that contains only the even numbers. (Hint: use reminder function) Sample runs: (get-even-nums ‘(1 2 3 4 5 6 7 8 9)) should return (8 6 4 2). (get-even-nums ‘(1 3 5 7 9)) should return ’( ).

  • 5.19 LAB: Contains the character Write a program that reads an integer, a list of words,...

    5.19 LAB: Contains the character Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. The output of the program is every word in the list that contains the character at least once. Assume at least one word in the list will contain the given character. Assume that the list will always contain less than 20 words. Each word will always contain less than 10 characters...

  • Write programs for the Ackerman function shown below in C and in Scheme (Racket). Functionality and...

    Write programs for the Ackerman function shown below in C and in Scheme (Racket). Functionality and Documentation is critical in these programs. Be sure your code is your own. If you get outside help, you will receive a zero for this exam. When you submit the programs, upload the c code and scheme code in separate files. The Ackermann function is defined recursively for two non-negative integers’ s and t as follows. A(s, t) = {(t+1,@A(s-1,1),@A(s-1,A(s,t-1)),)┤ ■(if s=0@ if s>0...

  • Objective To program using the functional programming paradigm Assignment: Write the following functions using Scheme (or...

    Objective To program using the functional programming paradigm Assignment: Write the following functions using Scheme (or LISP if you prefer) . A function (binomial N k) that returns the binomial coefficients C(N, k), defined recursively as: C(NO) = 1, C(N, N) = 1, and, for 0<k < N E(N, k) = C(N-1, k) + C(N-1, k-1) 2. A function (mod N M) that returns the modulus remainder when dividing N by M 3. A function (binaryToDecimal b) that takes a...

  • (C++) Write a function, remove, that takes three parameters: an array of integers, the number of...

    (C++) Write a function, remove, that takes three parameters: an array of integers, the number of elements in the array, and an integer (say, removeItem). The function should find and delete the first occurrence of removeItem in the array. (Note that after deleting the element, the number of elements in the array is reduced by 1.) Assume that the array is unsorted. Also, write a program to test the function. Your program should prompt the user to enter 10 digits...

  • 9. (5 points) Please describe an algorithm that takes as input a list of n integers...

    9. (5 points) Please describe an algorithm that takes as input a list of n integers and finds the number of negative integers in the list. 10. (5 points) Please devise an algorithm that finds all modes. (Recall that a list of integers is nondecreasing if each term of the list is at least as large as the preceding term.) 11. (5 points) Please find the least integer n such that f() is 0(3") for each of these functions f()...

  • use python Write a function that will sort a given list using merge sort. You must...

    use python Write a function that will sort a given list using merge sort. You must use the merge sort algorithm (but may be recursive or iterative). The function will take a list as an input and return a sorted version of the list (you may assume it will be a list of integers). The method signature must be merge_sort(lst).

  • A java exercise please! Write a static method named swapHavles that takes an ArrayList of integers...

    A java exercise please! Write a static method named swapHavles that takes an ArrayList of integers as a a parameter and returns a new ArrayList that has every element in the second half of the original ArrayList swapped with every element in the first half of the original ArrayList. Note: • You can assume that the ArrayList passed to this method as a parameter always contains an even number of elements and will always contain at least two elements. For...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT