Hey Alex,
What I need is an "and" - with collects, I do a (sect of L1 L2) ... I tried
a bunch but cant seem to get "and" working -
I need the items that are "RED" and "BLUE" :(
Perhaps I have to adjust the ER to achieve this?
regards,
Kashyap

On Tue, Nov 26, 2019 at 7:42 AM C K Kashyap <ckkash...@gmail.com> wrote:

> Thanks Alex,
> I'll try it out.
> Regards,
> Kashyap
>
> On Mon, Nov 25, 2019 at 11:24 PM Alexander Burger <a...@software-lab.de>
> wrote:
>
>> 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
>>
>

Reply via email to