Function: SUBSEQ-FIRST-SENTENCE

Source

(defun subseq-first-sentence (string limit)
  (with-output-to-string (first-sentence)
    (flet ((ret ()
             (return-from subseq-first-sentence
               (get-output-stream-string first-sentence))))
      (loop
        for char across string
        for count below limit
        if (member char (list #\. #\? #\!))
          do (write-char char first-sentence)
          and do (ret)
        else
          do (write-char char first-sentence)
        finally (ret)))))
Source Context