Question: please help me complete this function using BSL DrRacket thank you (@htdf sink) (@signature ListOfBlob -> ListOfBlob) ;; produce a list of blobs that sinks
please help me complete this function using BSL DrRacket thank you
(@htdf sink) (@signature ListOfBlob -> ListOfBlob) ;; produce a list of blobs that sinks the given solid blobs by one
(check-expect (sink empty) empty) (check-expect (sink (cons "bubble" (cons "solid" (cons "bubble" empty)))) (cons "bubble" (cons "bubble" (cons "solid" empty)))) (check-expect (sink (cons "solid" (cons "solid" (cons "bubble" empty)))) (cons "bubble" (cons "solid" (cons "solid" empty)))) (check-expect (sink (cons "solid" (cons "bubble" (cons "bubble" empty)))) (cons "bubble" (cons "solid" (cons "bubble" empty))))
(check-expect (sink (cons "solid" (cons "bubble" (cons "solid" empty)))) (cons "bubble" (cons "solid" (cons "solid" empty)))) (check-expect (sink (cons "bubble" (cons "solid" (cons "solid" empty)))) cons "bubble" (cons "solid" (cons "solid"))) (check-expect (sink (cons "solid" (cons "solid" (cons "bubble" (cons "bubble" empty))))) (cons "bubble" (cons "bubble" (cons "solid" (cons "solid")))))
;(define (sink lob) lob) ;stub
(@template-origin ListOfBlob)
(@template (define (render-blobs lob) (cond [(empty? lob) (...)] [else (... (fn-for-blob (first lob)) (render-blobs (rest lob)))])))
(define (sink lob) (cond [(empty? lob) (...)] [else (... (fn-for-blob (first lob)) (sink (rest lob)))]))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
