Below is a question that I have issues with I have code but not working if you c
ID: 3663815 • Letter: B
Question
Below is a question that I have issues with I have code but not working if you could help me to figure it out it would be much appreciated. Below the question is my current code. Not sure how to test it either
Write before-in-list?, which takes a list and two elements of the list. It should return #t if the second argument appears in the list argument before the third argument: > (before-in-list? '(back in the ussr) 'in 'ussr) #T > (before-in-list? '(back in the ussr) 'the 'back) #F
The procedure should also return #f if either of the supposed elements doesn't appear at all.
; Write before-in-list?, which takes a list and two elements of the list. It
; should return #t if the second argument appears in the list argument before the third
; argument: ; ; > (before-in-list? ’(back in the ussr) ’in ’ussr) ; #T
; ; > (before-in-list? ’(back in the ussr) ’the ’back) ; #F
; ; The procedure should also return #f if either of the supposed elements doesn’t appear
; at all.
(define (before-in-list? lst a b)
(cond
((null? lst) #f)
((equal? (car lst) a) (member? b (cdr lst)))
((equal? (car lst) b) #f)
(else (before-in-list? (cdr lst) a b))))
Explanation / Answer
your also is fine, you may apply regrression and broundry value testing
I advise you to write this progeram in some programming langugae
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.