On Thu, Nov 28, 2019 at 11:45:23AM +0100, Alexander Burger wrote:
>    (de f (Names)
>       (pilog
>          (quote
>             @Names Names
>             @Gen (mapcan '((C) (list 'nm '+TagVal C)) Names)
>             (select (@Item)
>                ((@Gen (v +Tag) itm))
>                (lst @Tag @Item tgs)
>                (val @Nm @Tag v nm)
>                (member @Nm @Names) ) )
>          (print-item @Item) ) )
> 
> But not what you want, right? It is still OR, not AND ...

This is tough to do in Pilog. As Prolog is not more than a tree *search* engine,
it is hard to prove that there is NO element in Names which canNOT be found in
the tags names.

It is surely possible, with 'or' and 'not' clauses plus cut operators, but I
don't find it at the moment.

So I would resort to Lisp in the filter:

   (de f (Names)
      (pilog
         (quote
            @Names Names
            @Gen (mapcan '((Nm) (list 'nm '+TagVal Nm)) Names)
            (select (@Item)
               ((@Gen (v +Tag) itm))
               (^ @
                  (fully
                     '((Nm)
                        (find
                           '((This) (member Nm (: v nm)))
                           (; (-> @Item) tgs) ) )
                     (-> @Names) ) ) ) )
         (print-item @Item) ) )

   (f '("RED" "BLUE"))

☺/ A!ex

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

Reply via email to