;; Ces programmes sont sous licence CeCILL-B V1. ;; Exécution en ligne de commande avec Bigloo : ;; $ bigloo -i Oui-do.scm (define (Oui) (let* ((s "oouui un ouui ou un non ce n'est pourtant pas la même chose ouui") (resultat (Present? "oui" s))) (if resultat (display resultat) (display "Pas de oui")) (newline))) (define (Present? mot texte) (let* ((l-mot (string-length mot)) (l-texte (string-length texte)) (derniere-chance (- l-texte l-mot))) (do ((n 0 (+ n 1))) ((or (> n derniere-chance) (string=? (substring texte n (+ n l-mot)) mot)) (if (> n derniere-chance) #f n))))) (Oui)