Hi Dean,

> (de fltr (Buf Ln)
>    (setq New_buf (mapcar '((Ele) (pack (tail (- (length Ln)) (chop Ele))))
>       (filter '((Ele) (pre? Ln Ele)) Buf))))
> ...
> #: (fltr '(aa ab) 'ab)
> #-> (NIL)

You can use 'extract' to get exactly the results you need:

   (de fltr (Buf Ln)
      (let N (inc (length Ln))
               (when (pre? Ln Ele)
                  (pack (nth (chop Ele) N)) ) )
            Buf ) ) )

Perhaps 'match' is more elegant than 'pre?' and 'nth' or 'tail':

   (de fltr (Buf Ln)
      (let Pat (conc (chop Ln) '(@Rest))
         (use @Rest
                  (and (match Pat (chop Ele)) (pack @Rest)) )
               Buf ) ) ) )

In both cases:

   : (msg (fltr '(aa ab abc) 'ab))
   -> ("c")

♪♫ Alex
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to