Please use DrRacket Programming
Write a structurally recursive function named (tails lst) that takes a list as an argument and returns all the sublists of the list. For example:
> (tails '(1 2 3))
'((1 2 3) (2 3) (3) ())
> (tails '((a b) (c d)))
'(((a b) (c d)) ((c d)) ())
Think carefully about what the function should return if it receives the empty list as an argument.
Finish this template:
(define tails
(lambda (lst)
Code:
(define tails
(lambda (lst)
(cond ((null? lst) '(())) ;;if list is empty returns '(())
(else (cons lst (tails (cdr lst))))))) ;;else recursively cons the
sub lists
Snapshot of Code and Output:

Please use DrRacket Programming Write a structurally recursive function named (tails lst) that takes a list...
Python3: Write the function findLongestStreak(lst) which takes a list of numbers, lst, and returns the longest streak of numbers which occur in the list. A streak of numbers is a list of numbers where each number is one greater than the one that occurred before it- for example, [4, 5, 6, 7]. So findLongestStreak([3, 4, 8, 2, 3, 4, 5, 7, 8, 9]) would return [2, 3, 4, 5]. If there is more than one streak with the longest length,...
in python Part I: Sum of Odd Integers Write a recursive function sum-odds that takes a non-empty list of integers as an argument and returns the sum of only the odd integers in the list. In class we explored a recursive function called rsum that recursively computes the sum of a list of integers use it as a model to get started. Your function must be recursive and must not use any loops
solve with python
Write a recursive function recStringWithLenCount() that takes a
one-dimensional list of strings as a parameter and returns the
count of strings that have at least the length of second parameter
passed into the function that are found in the list. Recall that
you can determine whether an item is a string by writing type(item)
== str. The only list functions you are allowed to use are len(),
indexing (lst[i] for an integer i), or slicing (lst[i:j] for...
Use DrRacket to write a Scheme program that takes a list and computes the number of atoms in the list. Name your source code num_atoms.rkt. Here are some examples > (num atoms '((a b) c (d (e f)))) 6 > (num_ atoms '(1 2 34 5)) >(num_atoms '((1 2 3 45))) >(num atoms (O))
Write a recursive function named arithmeticSum that takes a positive integer parameter n and returns the sum of the integer numbers from 1 to n Please write in C++
Define a function funD2(...) which receives a list lst that contains single letters, single digits and single special characters (and the list contains at least one element of each type). The function returns a string that contains the last letter and the last special character of the list, where each is repeated as many times as the sum of all digits in the list. As an example, the following code fragment: lst = ["a","b","c", 1, 2, "$","%"] print (funD2(lst)) should...
Write the function below in scheme/lisp programming language. Drracket Exercise: It is well known that n^2 is equal to the sum of the first n odd numbers. For example, 16 = 4^2 = 7 + 5 + 3 + 1. Write a function that takes as input a natural number, n, and that returns the square of its input by adding the first n odd numbers. Your code may not contain delayed operations and must use accumulative recursion.
Using Python Programming Language:
3. Write a function flatten that takes a 2D list and returns all the items of each list concatenated together into one new 1D list. For example: flatten ([["a", "b"],["c","0"],["e","f"]]) would return ["a", "b","C","d", "e","f"] Save the function in a PyDev library module named functions.py Write a program t03.py that tests flatten function and prints the returned flat list to the screen. Test your program with a different list, hardcoded in t03.py • Copy the results...
Write a recursive function bag_to_set that takes a list as a parameter and returns a new list in which the values that were in the old list appear only once in the new list (the order should be preserved). Sample data: Old list: [4, 5, 3, 4, 5, 2, 2, 4] New list: [4, 5, 3, 2] The function signature is: def bag_to_set(bag): """ ------------------------------------------------------- Copies elements of a bag to a set. Use: new_set = bag_to_set(bag) ------------------------------------------------------- Parameters: bag...
Write a recursive function named multiply that takes two positive integers as parameters and returns the product of those two numbers (the result from multiplying them together). Your program should not use multiplication - it should find the result by using only addition. To get your thinking on the right track: 7 * 4 = 7 + (7 * 3) 7 * 3 = 7 + (7 * 2) 7 * 2 = 7 + (7 * 1) 7 *...