I've got this filtering function....

(de fltr (Buf Ln)
   (setq New_buf (mapcar '((Ele) (pack (tail (- (length Ln)) (chop Ele))))
      (filter '((Ele) (pre? Ln Ele)) Buf))))

If any element 'Ele' of Buf starts with Ln ....it get's put into New_buf
but not before the the Ln part is chopped off the front.
In an ideal world any matching Ele will be the SAME length as Ln but I've
found that Some matches are split over Consecutive lines.
The first example below shows that Ln=Ele i.e. returning (NIL)....Any NIL
in New_buf will end the search satisfactorily...I only need one!

#: (fltr '(aa ab) 'ab)
#-> (NIL)

These show what happens when the match is split over multiple lines i.e. it
gets there in the end.

#: (setq L (fltr '(aa ab) 'a))
#-> ("a" "b")
#: (fltr L 'b)
#-> (NIL)

My problem is that the "real" code is more involved and in order not to
have to write it out in "fully" for each time I use it (3) I thought I'd
use objects.
Whilst the 'ab match properly returns (NIL)....the split match i.e. 'a and
then 'b cause the member New_buf to disappear altogether from the object
i.e. not return (NIL) like above.
I thought I'd test if (NIL) means nothing but get that NIL in (NIL) is
undefined.

(if (= NIL (NIL)) (prinl "yes") (prinl "no"))
#!? (NIL)
#NIL -- Undefined

Is there a good reason why New_buf should disappear rather hold (NIL) when
this is done in an object
and is NIL in (NIL) undefined when it gets returned as shown above?
Any advice much appreciated....
I could move around this problem by doing the filtering and chopping in two
stages with some testing in between
but thought it would help with my development to ask.

Reply via email to