Clojure member function question
Hi, im trying to write recursive function in Clojure and am stuck
The given scheme is : (define (member atm lizt)
(cond ((null? lizt) #f)
((eq? atm (car lizt)) #t)
(else (member atm (cdr lizt))) )
Can you translate that to Clojure member that is recursive?
Answer
The recursive scheme function member checks if the given element is a member of the list or not. It returns #t if the element is in the list else it returns #f.
Below is the scheme member function call examples.

Below is the translation of scheme member function to Clojure member function that is recursive.
(defn member [atm lizt] ;member function with parameter atm and lizt
(cond ;conditional evaluation
(empty? lizt) false ;if lizt is empty, return false
(identical? atm (first lizt)) true ;if atm is equal to first element of lizt, return true
:else (member atm (rest lizt)))) ;else call member function recursively to find atm
Sample Output

Clojure member function question Hi, im trying to write recursive function in Clojure and am stuck...
Consider this scheme function and explain it
Consider the following Scheme function: (define f (lambda (1st) (cond (null? 1st)) 0) ((number? (car 1st) (+ 1 (f (cdr 1st)))) (else (f (cdr 1st))))) Explain what the function f computes for lists. consider (f '(1 a b 2)) for example.
I am stuck on trying to get this recursive function's logic to make it work. //Write a recursive function that returns true if the sequence of 0 < n integers in A is sorted in non-increasing order and false otherwise. iostream and cmath libraries only bool is_sorted(const int *A, unsigned int n){ if (n == 0) return false; if (A > A+1) return true; else return false; }
Hi, im trying to finish my Linux homework and im stuck on a coupls of questions. 1. A command that is entered on the command line consisting of one process or a series of processes using a pipe is considered a 'token' and can me managed as one entity. True False 2. The previous lead job has the character: - ^ + & = 3. The following field contains the state of the process (when you run the ps -aux...
Using Racket Recursion, tail-recursion, high-order functions and functional programming. 1. Modify our filter function so that it is tail-recursive. You may use the letrec form but do not use any additional forms and functions besides those we've talked about in class. (define filter (lambda (input-list func) (cond ((null? input-list) '()) ((func (car input-list)) (cons (car input-list) (filter (cdr input-list) func))) (else (filter (cdr input-list) func))))) 2. Test your filter function on '(25 -22 44 56...
1. Explain the function/purpose of the following sequence of program statements by expressing the postcondition and then prove that the program is correct using the axiomatic verification method. Precondition: {x = A and y = B} t=x x=y y=t Postcondition:________________ 2. Prove that the following grammar is ambiguous. <stmt> -> <assign> | <if-stmt> <assign> -> <id> := <expr> <if-stmt> -> if <bool> then <stmt> | if <bool> then <stmt> else <stmt> Modify the grammar above to make it unambiguous: 3....
PYTHON please help! im stuck on this homework
question, THANK YOU! please follow the rules!
Give a recursive python implementation of the following function: def check_Decreasing_Order(lissy): Given lissy, a python list of integers, the above function will return True if lissy is sorted in decreasing order, otherwise it will return false. For example, print(check_Decreasing Order([100,50,8, -2])) True print(check_Decreasing_Order([108,50,8,2,35])) False Implementation Requirements: 1. Your implementation must be recursive. 2. If you need more parameters, you may define new functions or helper...
Im trying to create a function in MATLAB that will calculate a function its exponential weights. Then I am supposed to plot it. Can I get help completing this code? function f = fssyn(Dn, w0, dt, dur) t = 0:dt:dur; n = (length(Dn)-1)/2; for i = 1:length(t) f(i) = Dn*exp(j*[-n:n]'*w0*t) end; f = real(f) plot(f) %FSSYN Function to synthesize a sum of cosine waves % usage: % fssyn(Dn, w0, dt, dur) %...
Hi im trying too do my Linux homework and I'm stuck on some questions 1. Using the utility chmod, permissions can be set on the owner, group, or others (aka "the world" or "everyone else"). True or False 2. Changing the permissions on the script file someScriptFile.sh to be write and read only will allow you to execute it (if it is a valid shell script with no errors) using ./someScriptFile.sh True or False 3. To set the permissions for...
PYTHON this implementation is really hard, Im stuck
especially with the requirements they give. PLEASE HELP! THANK YOU!
RECURSIVE!
Give a recursive python implementation of the following function: def check_Decreasing_Order(lissy): Given lissy, a python list of integers, the above function will return True if lissy is sorted in decreasing order, otherwise it will return false. For example, print(check_Decreasing Order([100,50,8, -2])) True print(check_Decreasing_Order([108,50,8,2,35])) False Implementation Requirements: 1. Your implementation must be recursive. 2. If you need more parameters, you may define...
Hi,
I am doing some revision on Fourier Transform on my own and I
got stuck on this question for five days now. Wonder if you can
help me.
Engineering Mathematics 4E, Anthony Croft
Ex, 24.8 Q1
I want to understand how to set the lower and upper bound in
each "range" by applying the floating "t" value.
And how does sliding the triangle or the square block affect the
convolution process.
Does fourier transform gives us greater flexibility than...