Hi Kashyap,
> Here's a new problem - as per the previous conversation, it seems that I
> could use "collect" to get the items that I am interested in.
>
> (let (RED (db 'nm '+TagVal "RED")
> BLUE (db 'nm '+TagVal "BLUE"))
> (setq L1 (collect 'v '+Tag RED RED 'itm))
> (setq L2 (collect 'v '+Tag BLUE BLUE 'itm)))
> (sect L1 L2) --> this is what I want
> It looks like the step> method of QueryChart calls "prove" which tells me
> that it can only do pilog.
Yes +QueryChart needs Pilog. In general, Pilog is also recommended if the
possible result set may be large and long 'collect'ed lists become inefficient.
So the 'v' index of '+Tag' needs to be traversed twice, once for the RED object
and once for BLUE.
To do the above in Pilog, you need a combined generator and a filter with 'or':
...
@Col1 (db 'nm '+TagVal "RED")
@Col2 (db 'nm '+TagVal "BLUE")
...
(select (@Tag)
(...
((v +Tag @Col1 v +Tag @Col2)) # Traverse tree twice
... )
(or ((same @Col1 @Tag v)) ((same @Col2 @Tag v))) # filter with OR
... )
or generate directly
...
@Col1 "RED"
@Col2 "BLUE"
...
(select (@Tag)
(...
((nm +TagVal @Col1 nm +TagVal @Col2) (v +Tag))
... )
(or ((same @Col1 @Tag v nm)) ((same @Col2 @Tag v nm)))
... )
(Not tested!)
☺/ A!ex
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe