6. Define a function f in Scheme which satisfies the following claim: "If N is a natural number then (f N) is the sum of the digits of N!."
Q: (define (doit n) (if (= n 0) 0 (+ n (doit (- n 1))) )) (print (doit 11)) Write…
A: According to the Question below the Solution: Output:
Q: 1. For each of the following regular expressions find a language (i.e., a set of strings) over A =…
A: a)a*bc+bc* Language is {bc,, abc,aabc,,aaabc,.......a,ac,acc,accc,,........} this regular expression…
Q: 2. What is the difference between computer structure and computer function? give examples.
A: Solution: A computer system is a complex is a complex and hierarchical in nature it contains many…
Q: Write a Scheme function that takes two non-negative numeric parameters, A and B, and returns A…
A: The code is below is in C language :
Q: Define a SCHEME function called mode that takes 3 numbers as parameters and returns the mode. (the…
A: //First sort the list (define (mode lst) (if (null? lst) #f ; edge case: an empty list…
Q: Explain the concept of static function by giving example of program(use only c++ language). Also…
A: Given: Static Function C++ Static Function: Static function is a function that uses static…
Q: computer engineering question: Reverse A String Without Using Perl's Built In Functions
A: Reverse A String Without Using Perl's Built-In Functions Please find the verified answer in the…
Q: Consider the following Scheme function: (define (mystery input-list) (cond ((null? input-list) 0)…
A: The function has a conditional expression using input list and null. The cdr function will take a…
Q: In BASIC language statement "300 LET A = 2(X+3)", syntax error is
A: In BASIC language statement "300 LET A = 2(X+3)", syntax error is
Q: Giving the following LISP functions, find which lines of code are correct and incorrect and explain…
A: defun f (l) ==> It is used for defining functions. The syntax is: (defun name (parameter-list)…
Q: Define the scope of variables and distinguish between local and global variables. Complete sentences…
A: The main difference between local and global variable is that, variables can be accessed globally…
Q: Write a function using scheme language, that takes in a list of values as input and produces the…
A: Basically, you need to do something like: (define (create-list . e) (dedupe e)) I can think of a…
Q: (b) Using the given translation key, give translations of the following sentences. B (x, y): x bores…
A: The answer for the given question is as follows.
Q: Please solve the problem in C++ . Print the sum, average and product of 5 numbers by creating a…
A: SUMMARY: -Hence, We discussed all the points
Q: 5. Let A be the class of languages accepted by FAs and B the class of languages represented by…
A: We Know that the power of Finite Automata (FAs) i.e class of language accepted by FAs is equal to…
Q: 3. Consider the TM below. Write the regular expression for the language of the given TM. b,b,R b₂b.R…
A:
Q: Translate the following Scheme function into OCaml/F# (define f (lambda (a b) (let ((c 5))…
A: Answer: I have done code and also I have attached code as well as code screenshot
Q: What is growth of function? How the growth of function and basic algorithmic analysis co related.
A: Given: What is growth of function? How the growth of function and basic algorithmic analysis co…
Q: (2) The following questions are related to regular expression and regular language: (i) Let E= {a,…
A: We have to find out the regular expressions which are for regular language. For any given alphabet,…
Q: please do Scheme language #3. Show/and document (explain) Factorial (n) using recursion
A: Step 1:- Note:-As per policy , We are entitled to answer the first question only. Recursion Function…
Q: Topic: Concepts of programming Language Compute the weakest precondition for the following…
A: Please refer below for your reference:
Q: Syntactically different regular expressions may represent the same language. Consider regular…
A: The Regular expression is the pattern which describes the set of the strings that matches the…
Q: Define the following concepts and arguments in detail: a) Formal Language. b) Cardinality. c)…
A: Defined the given concepts
Q: Find the most general unifier or explain why it doesnt exist (capital letters are…
A: Answer :- 1) l(A,W,f(A)) and l(B,g(B,C),C) is most general unifier because the data…
Q: 4. Write a Scheme program for computing a maximum of function f(x) within the interval [x1, x2]. Use…
A: Trisection algorithm:Let us consider the following problem of determining the root of a continuous…
Q: Use recursive definition Define the language L, in which all words contain only 2 b’s but any…
A: Given: Use recursive definition Define the language L, in which all words contain only 2 b’s but…
Q: a) A token is a sequence of characters that can be treated as a single logical entity. A pattern is…
A: Please refer below for your reference: Tokens : Tokens is defined as a sequence of characters that…
Q: 3. Give regular expressions that describe the following languages, whose alphabet is Σ = {ab}. (a)…
A:
Q: hich of the following definitions below erates the same language as L Where Ly 11 tyy
A: Given that expression is L= xn yn such that n >= 1 Given language is context free language, but…
Q: Write a function using scheme language, that takes in a list of values as input and returns true if…
A: Functions is given below
Q: Write a function using scheme language, that takes in a list of values as input and returns true if…
A: Summary: In this question, we will be given a list of numbers and we have to tell that if any number…
Q: * ?Which of the following statement is true Every language that is defined by regular expression can…
A: Option D i.e. All the above is correct. As every language can be defined by finite automata can be…
Q: 3. Give regular expressions that describe the following languages, whose alphabet is Σ = {a,b}. (a)…
A: This is called context-free grammar. ALSO referred to as CFG. To solve the given equation, we must…
Q: Consider X=5, Y=10. With help of examples explain the following operators: a. Assignment and…
A: Required: Consider X=5, Y=10. With help of examples explains the following operators: a. Assignment…
Q: (b) Using the given translation key, give translations of the following sentences. B (x, y): x bores…
A: Solution for the above question is solved in step 2 :-
Q: Which of the functions below is syntactically corrects I.e. Which function has no error of any kind?
A: In Python, we don't have parenthesis to open or close block of code. Everything is taken care by…
Q: Define variables' scope and make a distinction between local and global variables. Sentences should…
A: Introduction: The most significant distinction between local and global variables is that variables…
Q: (b) Using the given translation key, give translations of the following sentences. B (x, y): x bores…
A: The above question is answered in step 2:-
Q: Using Scheme/racket Define a function maximum-of-many that takes as argument two or more numbers and…
A: Code: (define (length lst) (cond [(empty? lst) 0] [(cons? lst) (+ 1 (length (rest…
Q: Giving the following LISP functions,find which lines of code are correct and incorrect and explain…
A: In this question we have to look at the program and explain the correct or incorrect manner of…
Q: 1. For each of the following regular expressions find a language (i.e., a set of strings over A =…
A: 1. Defined a languages for the given regular expressions
Q: Create a SCHEME file/program that implements a quadratic equation solver and calls it with 1, 0, -25…
A: convert temperature from Celsius to Fahrenheit
Q: Write a scheme function that require user to input a character. Check whether the character is equal…
A: The question is to write a scheme function that require user to input a character. Check whether the…
Q: How the growth of function and basic algorithmic analysis co related?
A: Given: How the growth of function and basic algorithmic analysis co related?
Q: Find the regular expressions describing the following languages defined over the alphabet Σ = {0,1}:…
A: Regular expression for given language 1*(0+1+0+1+0+1+)*1*
Q: Assume the following recursive function: (M-4) int sequence(int num) //Line 1 { //Line 2 if (num ==…
A: a) Base case is a way to return without making a recursive call. ie, if (num==0) recursive call is…
Please answer very soon
Step by step
Solved in 2 steps with 1 images
- Consider two strings A and B. Take string A as your First name and Last name without space in-between (eg: rahulverma) and string B as the name of your home town (eg: JALANDHARCITY). Now find the Longest Common Subsequence (LCS) common to strings A and B using Dynamic ProgrammingWhat is the ML type of (3,[4,5]) ? b) What is the ML type of function f? fun f x y = (x,y) e) True or False : TRUE FALSE Every partial function is a total functionPlease translate the following English sentence into a sentence of FOL: use quantifiers "Lucia owns exactly one guitar" Domain: people and things M(x): x is a musician G(x):x is a guitar player R(x): x is a guitar O(x,y): x owns y L: lucia
- Using Scheme/racket Define a function maximum-of-many that takes as argument two or more numbers and returns the maximum one. e.g.,(maximum-of-many 10 20 30 40) => 40(maximum-of-many 12 8) => 12A function k whose domain is the set of positive integers is defined as k(1)=4 and k(n)=k(n-1)-2. Function k was evaluated for several numbers. Select each statement below that is true. A - k(0)=−2 B - k(2)=2 C - k(3)=0 D - k(6)=3 E - k(−1)=−4(For thought) a. A token of a computer language is any sequence of characters, with no intervening characters or white space, that taken as a unit has a unique meaning. Using this definition of a token, determine whether escape sequences, function names, and the keywords listed in Table 2.1 are tokens of the C++ language. b. Discuss whether adding white space to a message alters the message and whether messages can be considered tokens of C++. c. Using the definition of a token in Exercise 4a, determine whether the following statement is true: “Except for tokens of the language, C++ ignores all white space.”
- This is to be done in ML coding language. Please provide the actual code, and try to keep the code as simple as possible. Define a function which computes the product of all integers betweenm and n (with n >= m) inclusive. Use this function to define the function Cn,k (thenumber of combinations of n elements taken k by k), which is defined by Cn,k = n!/(k!*(n-k)!) Test your code with sample input and report result.Translate these statements into English, where C(x) is “x is a comedian” and F(x) is “x is funny” andthe domain consists of all people.a) ∀x(C(x) → F(x))b) ∀x(C(x) ∧ F(x))c) ∃x(C(x) → F(x))1. Question : Simplify the following functions using Boolean algebra rules: F1 = a.b+c’+c(a’+b’) F2 = (x.y’+z)(x+y’)z 2. Question : Convert the following function to POS standard form F3 = (? + ?) (?̅+ ? + ?) • Convert the following function to SOP standard form F4 = (? + ?) (?̅+ ? + ?) 3. Question : • Use K-maps to minimize the following functions F5 = a’b’d+a’bc’d+a’bcd F6 = ∑(0,2,5, 9,10 11,12,13)
- Write a C function called divisible that takes N and M as parameters and returns True if N is evenly divisible by M.Let Cbe the language over {a, b,c, d, e, f} accepting all strings so that: 1.There are precisely two b’s in the string. 2.Every a is immediately followed by an odd number of e’s. 3.Every d is immediately followed by an even number of f’s. 4.e’s and f’s don’t occur except as provided in rules 2 and 3. 5.All a’s occur after the first b. 6.All d’s occur before the second b. 7.In between the two b’s there are exactly twice as many a’s as d’s.HINT: Don’t be intimidated by the number of rules. The way they interact actually helps you simplify the number of cases you have to deal with while constructing this grammar. a. Construct a context-free grammar generating C.Explain how your construction accounts for each rule. b. We could eliminate one rule from Cand make it regular. Which rule would that be, and why would it work? You do not need a formal proof, but you do need an explanation.Consider an airport management system. Each airport has a unique id (e.g. Montreal:YUL). Let us introduce the types AIRPORT and CITY . We also introduce variable airports that contains associations between airport id’s and their corresponding host cities. A possible state of the system is shown below:airports ={YUL → Montreal,LCY → London_UKLHR → London_UK,MIL → Milan,SFO → San_Francisco,SDQ → Santo_Domingo}1. (PROGRAMMING) Define global variable airports in Common LISP and populate it with the above data. Demonstrate that the variable indeed contains the ordered pairs as shown above.2. Provide a declaration of variable monitored that holds all airport id’s.3. What kind of variable is airports? Provide a formal definition together with any and all applicable properties.4. Describe what data structure you would deploy to model variable airports. Note that you may not use a Dictionary. Should this be an ordered or an unordered structure? Discuss.5. Provide a formal specification of the…