Question: 5. A functional language could use some data structure other than the list. For example, it could use sequences of symbols. What primitives would such

5. A functional language could use some data structure other than the list. For example, it could use sequences of symbols. What primitives would such a language have in place of the CAR, CDR, and CONS primitives of Scheme? What does the following Scheme function do? 8. (define (y s lis) (cond (null? lis) 0) ((equal? s (car lis)) lis) (else (y s (cdr lis) 9. What does the following Scheme function do? (define (x lis) cond (null? lis) 0) (not (list? (car lis)) cond ((eq? (car lis) nil) (x (cdr lis) else (+ 1 (x (edr lis))) (else (+ (x (car lis) (x (cdr lis)))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
