You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sicp-all-tasks/sicp/4_002e74

22 lines
684 B

Exercise 4.74: Alyssa P. Hacker proposes to use
a simpler version of stream-flatmap in negate, lisp-value,
and find-assertions. She observes that the procedure that is mapped
over the frame stream in these cases always produces either the empty stream or
a singleton stream, so no interleaving is needed when combining these streams.
Fill in the missing expressions in Alyssa’s program.
(define (simple-stream-flatmap proc s)
(simple-flatten (stream-map proc s)))
(define (simple-flatten stream)
(stream-map ⟨??⟩
(stream-filter ⟨??⟩
stream)))
Does the query system’s behavior change if we change it in this way?