Practice with Scheme Dr. Scheme can be downloaded for FREE at http://plt-scheme.
ID: 2246437 • Letter: P
Question
Practice with Scheme
Dr. Scheme can be downloaded for FREE at http://plt-scheme.org/
1. (1 point) Write a function in Scheme to return –1, 0, +1 depending on two parameters a and b:
a < b return –1
a > b return +1
a = b return 0
2. (3 points) Write a recursive function in Scheme, called “get-element” which takes two parameters, an index and a list. The function returns the element at the given index position in the list or #f if element is not contained. Indices start at 1 and go to the length of the list.
3. (1 point) Question: How would you change the function so it returns the whole list if the element is not contained?
Explanation / Answer
PLT Scheme is an innovative programming language that builds on a rich academic and practical tradition.
It is suitable for implementation tasks ranging from scripting to application development, including GUIs, web services, etc.
It includes the DrScheme programming environment, a virtual machine with a just-in-time compiler, tools for creating stand-alone executables, the PLT Scheme web server, extensive libraries, documentation for both beginners and experts, and more.
It supports the creation of new programming languages through a rich, expressive syntax system. Example languages include Typed Scheme, ACL2, FrTime, Lazy Scheme, and ProfessorJ (which is a pedagogical dialect of Java)
PLT Scheme is an innovative programming language that builds on a rich academic and practical tradition.
It is suitable for implementation tasks ranging from scripting to application development, including GUIs, web services, etc.
It includes the DrScheme programming environment, a virtual machine with a just-in-time compiler, tools for creating stand-alone executables, the PLT Scheme web server, extensive libraries, documentation for both beginners and experts, and more.
It supports the creation of new programming languages through a rich, expressive syntax system. Example languages include Typed Scheme, ACL2, FrTime, Lazy Scheme, and ProfessorJ (which is a pedagogical dialect of Java)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.