- 836 名前:デフォルトの名無しさん mailto:sage [2012/02/06(月) 19:03:40.19 ]
- >>835
reduceを使えば良いんじゃないかな。というわけで、こんなんできました。 ハードコーディングしてる部分は、実際のコードでは修正してー。 (labels ((has-prefix-p (prefix x) (let ((p (search prefix x))) (and p (zerop p)))) (foop (x) (has-prefix-p "foo" x)) (testp (x) (has-prefix-p "test" x))) (reduce (lambda (x r) (if r (destructuring-bind (last . rest) r (if (and (foop last) (testp x)) (cons (concatenate 'string x (subseq last (length "foo"))) rest) (cons x r))) (cons x r))) *list* :from-end t :initial-value nil))
|

|