San Jose State University

CS 252 - Advanced Programming Languages

Cay S. Horstmann

Fall 2009

Prerequisite Quiz

Please email to Cay.Horstmann@sjsu.edu with Subject: CS252 Prerequisite Quiz

Your Name:

Are you an open university student? No [ ] / Yes [ ]

Please rate your knowledge of these topics:

Which operating system(s) do you have on your laptop? Linux [ ] / Mac OS X [ ] / Windows XP [ ] / Windows Vista [ ] / Windows 7 [ ]

Describe the undergraduate programming language course equivalent to CS152 that you took: institution, course name, semester taken, grade received.

Provide a program in your favorite functional language (Scheme, ML, JavaScript, Scala, Clojure, whatever) that contains a function firstMatches with three parameters

The function should return the first n elements of l for which f is true (or, if there are fewer than n, then return those). Write a recursive solution that doesn't use any library functions other than the basic functions for accessing a list or collection.

Attach a screen shot that shows how you tested your function.