Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Is anyone good with Racket? I am trying to define this function only using car, cdr, cons, snoc, rac, rdc, cond, if, else, lambda, the

Is anyone good with Racket? I am trying to define this function only using car, cdr, cons, snoc, rac, rdc, cond, if, else, lambda, the basics. But, I am not sure how to do it.

I am trying to define thisFunction recursively.

define (thisFunction myList) This function creates upward ramp from myList. For example (thisFunction '()) returns () (thisFunction '(x)) returns (x) (thisFunction '(x y)) returns (x (y)) (thisFunction '(x y z)) returns (x (y (z))) (thisFunction '(x y z h)) returns (x (y (z (h)))) (thisFunction '(x y z h d)) returns (x (y (z (h (d)))))

This is how I tried to solve it. But, gives me an error message.

(define thisFunction (lambda (lis) (if (null? (car lis)) (cdr lis) (cons (car(lis)) thisFunction(cdr(lis))))))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

3rd Edition

0128012757, 978-0128012758

More Books

Students also viewed these Databases questions

Question

Were all members comfortable brainstorming in front of each other?

Answered: 1 week ago

Question

4. What will the team agreement contain?

Answered: 1 week ago