You must write each of the following scheme functions. You must use only basic scheme functions (those described in class), do not use third-party libraries to support any of your work. Do not use any function with side effects.
This problem need to use DrRacket software. Racket Language.
Write a function named (key-store L1 KEY) that accepts a list of two-tuples L1 and a value KEY. This function returns the second value of the first tuple that begins with KEY. If L1 doesn't contain the KEY, return the empty list.
(key-store '((a 2) (b c) (c (3 4))) 'c) ---> (3 4) (key-store '((a 2) (b c) (c (3 4))) 'b) ---> c (key-store '((a 2) (b c) (c (3 4))) 'z) ---> () (key-store '((() a)) '()) ---> a
CODE:
(define (key-store L1 KEY)
(cond ((null? L1) '()) ;;If List is empty returns NULL list
((equal? (caar L1) KEY) (cadar L1)) ;;If 1st tuple of 1st element
of list is equal to key then return 2nd tuple of that element
(else (key-store (cdr L1) KEY)))) ;;else continue searching in rest of list
Snapshot of Code and Output:

You must write each of the following scheme functions. You must use only basic scheme functions...
You must write each of the following scheme functions. You must use only basic scheme functions do not use third-party libraries to support any of your work. Do not use any function with side effects. This problem need to use DrRacket software. Racket Language. Write a function named (first-n L1 N) that returns the first N elements of L1. If N is negative, return the empty list. If N exceeds the length of L1 return all elements of L1. (first-n...
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))
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...
Write these two functions in Scheme: even1? odd1? Each accepts a number as input and returns #t or #f if the number meets the condition. The functions are named with a trailing 1 as Scheme already defines even? and odd?. You can check your answer with this simple test: (equal? (even1? 2) #t) (equal? (even1? 1) #f) (equal? (odd1? 1) #t) (equal? (odd1? 2) #f) (equal (square 2) 4)
Python 5. Write a function named grade_components that has one parameter, a dictionary. The keys for the dictionary are strings and the values are lists of numbers. The function should create a new dictionary where the keys are the same strings as the original dictionary and the values are tuples. The first entry in each tuple should be the weighted average of the non-negative values in the list (where the weight was the number in the 0 position of the...
All of the problems must be done in Haskell. You may download a local IDE or use [this website.][https://repl.it/languages/haskell]. You are not allowed any functions that trivialize a problem! Here are some examples of lists you can test your solutions on: let list1 = [5, 10, 15, 20, 25, 30] let list2 = [50, 100, 150, 200, 250, 300] Write a function that returns the maximum value in a list. Write a function that returns the nth element in the...
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.
Implement the following Racket functions: (You must use
recursion, and not iteration. You may not use side-effects (e.g.
set!). )
1. Reflexive? Input: a list of pairs, L and a list S. Interpreting Las a binary relation over the set S, Reflexive? returns #t if L is a reflexive relation over the set S and #f otherwise. Examples: (display "Reflexive?\n") (Reflexive? '((a a) ( bb) (cc)) '(a b c)) ---> #t (Reflexive? '((a a) (bb)) '(a b c)) ---> #f...
Help needed related python task ! Thanx again How you're doing it • Write a function write_to_file() that accepts a tuple to be added to the end of a file o Open the file for appending (name your file 'student_info.txt') o Write the tuple on one line (include any newline characters necessary) o Close the file • Write a function get_student_info() that o Accepts an argument for a student name o Prompts the user to input as many test scores...
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)