CSE240 – Introduction to
Programming Languages
Lecture 21:
Programming with LISP| Data Structures
Javier Gonzalez-Sanchez
javiergs@asu.edu
javiergs.engineering.asu.edu
Office Hours: By appointment
Quiz
Work in teams of 1 to 3
Javier Gonzalez-Sanchez | CSE 240 | Fall 2017 | 3
Solve 5 of the following problems
1. A function test-min that returns the lower value in a List of numbers
(test-min L)
2. A function test-average that returns the average of all values in a List of numbers
(test-average L)
3. A function test-fibonacci that prints the first n elements of the fibonacci series
(test-fibonacci n)
4. A recursive function that returns the leftmost even element in a list of numbers
(test-even L)
5. A functions that traverse a list and returns how many of its elements are 0
(test-count-zeros L)
6. A recursive function that return the N member of a list L (assuming that the
elements are numbered from zero onwards):
(test-get n L)
7. A recursive function that returns non-NIL if x is a member of the list L.
(test-is-in-list x L)
Javier Gonzalez-Sanchez | CSE 240 | Fall 2017 | 4
Instructions
Include for each problem:
a) A comment describing the function
b) The function definition
c) 3 examples of function calls
CSE240 – Introduction to Programming Languages
Javier Gonzalez-Sanchez
javiergs@asu.edu
Fall 2017
Disclaimer. These slides can only be used as study material for the class CSE240 at ASU. They cannot be distributed or used for another purpose.

201801 CSE240 Lecture 21

  • 1.
    CSE240 – Introductionto Programming Languages Lecture 21: Programming with LISP| Data Structures Javier Gonzalez-Sanchez javiergs@asu.edu javiergs.engineering.asu.edu Office Hours: By appointment
  • 2.
  • 3.
    Javier Gonzalez-Sanchez |CSE 240 | Fall 2017 | 3 Solve 5 of the following problems 1. A function test-min that returns the lower value in a List of numbers (test-min L) 2. A function test-average that returns the average of all values in a List of numbers (test-average L) 3. A function test-fibonacci that prints the first n elements of the fibonacci series (test-fibonacci n) 4. A recursive function that returns the leftmost even element in a list of numbers (test-even L) 5. A functions that traverse a list and returns how many of its elements are 0 (test-count-zeros L) 6. A recursive function that return the N member of a list L (assuming that the elements are numbered from zero onwards): (test-get n L) 7. A recursive function that returns non-NIL if x is a member of the list L. (test-is-in-list x L)
  • 4.
    Javier Gonzalez-Sanchez |CSE 240 | Fall 2017 | 4 Instructions Include for each problem: a) A comment describing the function b) The function definition c) 3 examples of function calls
  • 5.
    CSE240 – Introductionto Programming Languages Javier Gonzalez-Sanchez javiergs@asu.edu Fall 2017 Disclaimer. These slides can only be used as study material for the class CSE240 at ASU. They cannot be distributed or used for another purpose.