Write a Lisp function first-sat that takes two lists and a function foo as arguments. Function foo should take two arguments and return a Boolean (t or nil). The result of a call to first-sat should be a list containing the first pair of arguments that satisfies (returns true) from foo. For example: (first-sat '(1 4 3 5) '(2 5 1 4) #'(lambda (x y) (> x y))) Note that #' is the same as (function ... ) so (first-sat '(1 4 3 5) '(2 5 1 4) (function (lambda (x y) (> x y)))) returns (3 1).
Added by Kimberly C.
Step 1
```lisp (defun first-sat (list1 list2 foo) ...) ``` Show more…
Show all steps
Your feedback will help us improve your experience
Akash M and 54 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Using Scheme, write a function called "replace-first" that takes two arguments: an item and a list. The function should return a version of the list with its first element replaced by the item. If the list is empty (you can use the "null?" predicate to determine this), return the empty list.
Akash M.
In Scheme/Racket, write a function that takes in a list or vector of numbers and maps it to another list (or vector) where each element is the sum of itself and the subsequent elements in the list. (Ignore the term vector if you are unfamiliar with it.) f([e1, en]) = [Ci_1, ei, i=n, ei]
Sri K.
Call your function from Example 1 three times with different kinds of arguments: a value, a variable, and an expression. Identify which kind of argument is which.
Aarya B.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD