(module force-brute (main get-args)) (define (get-args args) (print (force-brute (cadr args) (caddr args)))) ;; les instruments (define (force-brute Texte Motif) (let* ((L-Texte (string-length Texte)) (L-Motif (string-length Motif)) (DerPos-Texte (- L-Texte 1))) (let boucle1 ((i 0) (j 0)) (let boucle2 () (if (and (< j L-Motif) (char=? (string-ref Texte (+ i j)) (string-ref Motif j))) (begin (set! j (+ j 1)) (boucle2)))) (cond ((= j L-Motif) i) ((< i DerPos-Texte) (boucle1 (+ i 1) 0)) (else -1)))))