[cl-irregsexp-devel] some smaller patches

John Fremlin john at fremlin.org
Wed Sep 30 16:30:20 UTC 2009


Hi Attila,

Thanks for the patches. I've looked them over.

Attila Lendvai <attila.lendvai at gmail.com> writes:
[...]
> Subject: [PATCH] don't abbreviate in integer &key max-len. also propagate them to make them usable as (foo (integer :max-length 2))

Propagation looks good.

However, why do you feel the need to rename max-len and min-len? They
are used already and there are still many variables called x-len . . .

I guess I should add specialised float matchers too.

[...]
> Subject: [PATCH] some care for replace.lisp, notably get rid of the
> single usage of iterate

What's wrong with iterate?

You change it to an nreverse! 

[...]
> -(defmacro match-replace-helper ( string &rest match-replacements)
> +(defmacro match-replace-helper (string &body match-replacements)

Why are you using BODY here for a non-code form?

> -  (with-unique-names (before replacement-text after)
> -    `(let (,replacement-text)
> -       (if-match-bind (,before (or 
> -				,@(loop for (match replacement) in match-replacements
> -					collect `(progn ,match '(setf ,replacement-text (force-to-target-sequence ,replacement))))
> -				(last))
> -			       ,after)
> -		      ,string
> -		      (values ,before ,replacement-text ,after)
> -		      nil))))
> -
> -(defun-speedy concat-byte-vector (seqs)
> -  (cond ((rest seqs)
> -	 (let ((len (loop for s in seqs summing (length (the byte-vector s)))))
> -	   (let ((ret (make-byte-vector len)) (i 0))
> -	     (loop for a in seqs do (let ((s (force-simple-byte-vector a))) (replace ret s :start1 i) (incf i (length s))))
> -	     ret)))
> -	(t
> -	 (force-byte-vector (first seqs)))))
> -
> -(defun-speedy concat-string (seqs)
> -  (apply 'concatenate 'string seqs))
> +(defun-speedy concatenate-sequences (prototype sequences)
> +  (etypecase prototype
> +    (string
> +     (let ((*print-pretty* nil))

This makes no difference I believe ^^^^

> +       (with-output-to-string (out)
> +         (dolist (el sequences)
> +           (write-string el out)))))

This rewrite seems in aid of faster string concatenation. I have a good
strcat somewhere, I can put that in. Do you have a benchmark? 

[...]





More information about the Cl-irregsexp-devel mailing list