Warning messages
Luís Oliveira
luismbo at gmail.com
Wed Aug 5 16:36:08 UTC 2015
On Wed, Aug 5, 2015 at 5:31 PM, Jerome Ibanes <jibanes at gmail.com> 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/
More information about the slime-devel
mailing list