Re: Warning messages
Luís Oliveira <[email protected]> Wed, 5 Aug 2015 17:36:08 +0100
| Newsgroups | gmane.lisp.slime.devel |
|---|---|
| Message-ID | <CAB-HnLTqMVSe01W82QMcLs=YucseV_DphyFxJ2Y5EM13XdtAtA@mail.gmail.com> |
On Wed, Aug 5, 2015 at 5:31 PM, Jerome Ibanes <[email protected]> wrote: > Warning: Local Variable Initialization clause (the binding of > SWANK::TPOS) follows iteration forms but will be evaluated before > them. Can you confirm that this fixes your problem? (in-package :swank) (defun make-compound-prefix-matcher (delimiter &key (test #'char=)) "Returns a matching function that takes a `prefix' and a `target' string and which returns T if `prefix' is a compound-prefix of `target', and otherwise NIL. Viewing each of `prefix' and `target' as a series of substrings delimited by DELIMITER, if each substring of `prefix' is a prefix of the corresponding substring in `target' then we call `prefix' a compound-prefix of `target'. DELIMITER may be a character, or a list of characters." (let ((delimiters (etypecase delimiter (character (list delimiter)) (cons (assert (every #'characterp delimiter)) delimiter)))) (lambda (prefix target) (declare (type simple-string prefix target)) (loop with tpos = 0 for ch across prefix always (and (< tpos (length target)) (let ((delimiter (car (member ch delimiters :test test)))) (if delimiter (setf tpos (position delimiter target :start tpos)) (funcall test ch (aref target tpos))))) do (incf tpos))))) Cheers, -- Luís Oliveira http://kerno.org/~luis/