(import strse (chicken string) srfi-13) (define dont-touch-me #t) (define set-me #f) (unless (string=? "that was SO very, very nice" (strse "this is freaking awesome" "is" "at" "at" "was so" 2 'word string-upcase 3 "very "(then (set! dont-touch-me #f)) "frea" "ve" "king" "ry" "very "(then (set! set-me #t)) (=> adjective "very") (conc adjective ", " adjective) 'word "nice" -1)) (error "Strings don't match!")) (unless (and set-me dont-touch-me) (error "Setting, then, side-effects system is borked")) (define (acc) (let ((things '())) (lambda thing (if (null? thing) things (set! things (cons (car thing) things)))))) (define (extract str) (define digs (acc)) (define words (acc)) (strse str (= 3 num) (then (digs (string->number (m 0)))) (+ alpha) (then (words (m 0)))) (list (digs) (words))) (unless (equal? (extract "it will get 234 and 123 and 747 but not 1983 or 42 but then again 420") '((420 198 747 123 234) ("again" "then" "but" "or" "not" "but" "and" "and" "get" "will" "it"))) (error "Bindings in then bodies borked")) (unless (strse? "banayna" "y") (error "Even strse? is off today!"))