As one quick reference to how to do as Sylwester hints (using MIT/GNU Scheme instead of Racket. But the basic ideas are just same):
(define (sublist? lst1 lst2)
(cond
;; recursion to find the possible starting location of lst1 inside lst2.
;; "starting" implies prefix?.
((prefix? lst1 lst2) #t)
((> (length lst1) (length lst2)) #f)
(else (sublist? lst1 (cdr lst2))))
)
(define (prefix? lst1 lst2)
(cond
;; Here assume '() is always one prefix of any sublist.
((null? lst1) #t)
;; lst1 is non-null, but lst2 becomes null, so length of lst2 is less.
((null? lst2) #f)
;; base test
((equal? (car lst1) (car lst2)) (prefix? (cdr lst1) (cdr lst2)))
;; some elems in lst1 doesn't satisfy the base test
(else #f)))
(sublist? '(a b d) '(a b c a b d e))
;Value: #t
(trace prefix?)
(prefix? '(a b) '(w a d f s))
; [Entering #[compound-procedure 13 prefix?]
; Args: (a b)
; (w a d f s)]
; [#f
; <== #[compound-procedure 13 prefix?]
; Args: (a b)
; (w a d f s)]
;Value: #f