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.
(defun sum-odds(number)
(do ((sum 0)
(i 1 (1+ i)))
((= i number*number) sum)
(when (oddp i)
(incf sum i))))
(sum-odds 4)
=> 15
Write the function below in scheme/lisp programming language. Drracket Exercise: It is well known that n^2...
Please use python 3 programming language Write a function that gets a string representing a file name and a list. The function writes the content of the list to the file. Each item in the list is written on one line. Name the function WriteList. If all goes well the function returns true, otherwise it returns false. Write another function, RandomRange that takes an integer then it returns a list of length n, where n is an integer passed as...
In Lisp programming language a 16. (20 pts.) Write a function that takes a list of 0's and l's and "toggles" each element. Your function should include lambda expression that knows how to flip an individual element, plus an applicative operator to do this to every element of the list. Example: 1 0) List (0 0 1 1 0 1) should be transformed into (1 1 0 0
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...
Python Programming Write a recursive function that takes positive int n as its input and returns sum of the first n squares, i.e 12 + 22 +...+n?
In scheme coding language Write a function filterN that returns only the numbers n through m from a lat. For example: (filterN 4 6 (1 turkey 5 9 4 bacon 6 cheese)) returns (5 4 6). Use only functions add1, sub1, and, or, <, >, null?, number?, zero?, define, lambda, cond, and else in the code. Assume n < m
Haskell Functional Programming Language: Write a function nestedParens that takes a string argument and returns true if it is a nesting of zero or more pairs of parentheses, e.g. "((()))" should return True ; "()()" or "(()))" should return False . Use recursion for this problem. nestedParens :: String -> Bool
Please help with all four questions regarding LISP Programming. Thank you. Please answer all questions with output plesase. LISP Programming Assignment It is a good idea to start this assignment early; Lisp programming, while not inherently difficult, often seem somewhat foreign at first, particularly when it comes to recursion and list manipulation. This assignment is loosely based on material by Dr. Henri Casanova. Problem #1 Define a function that takes two arguments and returns the greater of the two. Problem...
I need help solving this problem using the ML programming language Write a function sqsum of type int -> int that takes a non-negative integer n and returns the sum of the squares of all the integers 0 through n. Your function need not behave well on inputs less than zero
This is a python question. Write a function mult_table(n) that consumes a natural number n and returns the n+1 by n+1 multiplication table (where each entry in the inner list is equal to the product of which list it is and the inner list position number, or in other words, the product of the row and column numbers). Using accumulative recursion, no abstract list functions. def mult_table(n) ''' Returns the n+1 by n+1 multiplication table mult_table: Nat => (listof...
Ouestion 1 (15 pts) Write a lisp function triangle that takes an argument (n) and shows a triangle of printed numbers as shown in the following samples. If the input is decimal or string, it should print an appropriate message (triangle 4) (triangle 5) 1 2 1 2 3 1 2 3 4 1 2 1 2 3 1 2 3 4 1 2 3 4 5 (triangle 2.5), decinal numbers are not valid input, please enter an integer