On Tue, Nov 26, 2019 at 02:06:25PM -0800, C K Kashyap wrote:
> It seems to work as expected using collects :) Here's the complete program
> - it prints out ITEM1 and ITEM6 as expected.

Ah, right, you select items, not tags, and items have a *list* of tags.

OK. Then to get AND, you can instead of an explicit OR clause

   ...
   (or ((same @Col1 @Tag v nm)) ((same @Col2 @Tag v nm)))
   ...

simply employ the inherent AND mechanism of Pilog/Prolog

   ...
   (same @Col1 @Item tgs v nm)
   (same @Col2 @Item tgs v nm)
   ...


With your example, this works:

   (pilog
      (quote
         @Col1 "RED"
         @Col2 "BLUE"
         (select (@Item)
            (((nm +TagVal @Col1  nm +TagVal @Col2) (v +Tag) itm))
            (same @Col1 @Item tgs v nm)
            (same @Col2 @Item tgs v nm) ) )
      (print-item @Item) )


BTW, as the names of +TagVal seem unique, and substrings are not searched, it is
better to use +Key instead of +IdxFold:

   (class +TagVal +Entity)
   (rel nm (+Key +String))

☺/ A!ex

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

Reply via email to