Hi Alex,
I'll need a little bit more help with Pilog in QueryChart - In the code
below, I get the tags as a list of space separated words in the *Tags
variable. I create the @Names and @Gen pilog variables using *Tags. As you
can see @Gen uses @Names inside it but I am not sure how to reuse the
definition of @Names inside the definition of @Gen. I tried wrapping the
whole "gui" call inside a let binding but that does not seem to work
either. What's the way out?

   (diaform '(Dst)

                (<grid> "--"

                     "Name" (gui 'ttl '(+DbHint +Var +TextField) '(ttl
+Task) '*Name 20)

                     "Tags" (gui 'tags '(+Var +TextField) '*Tags 20)

                     (searchButton '(init> (: home query)))

                 )

                (gui 'query '(+QueryChart) *ROWS

                         '(goal

                             (quote

                                 @Names (filter '((X) X) (mapcar '((X)
(uppc (pack X)))  (split (chop *Tags) " ")))

                                 @Gen (mapcan '((Nm) (list 'nm '+TagNm Nm))
'(filter '((X) X) (mapcar '((X) (uppc (pack X)))  (split (chop *Tags) "
"))))

                                 (select (@@)

                                     ((@Gen (nm +Tag) tsk))

                                       (^ @

                                           (fully

                                              '((Nm)

                                                 (find

                                                    '((This) (or T (member
Nm (: nm nm))))

                                                    (; (-> @@) tgs) ) )

                                              (-> @Names) ) )

                                 )

                              )

                          )

                          1

                         '((This) (list This))

                 )



On Fri, Nov 29, 2019 at 7:31 AM C K Kashyap <ckkash...@gmail.com> wrote:

> Oh yes! got it.
> Regards,
> Kashyap
>
> On Thu, Nov 28, 2019 at 11:10 PM Alexander Burger <a...@software-lab.de>
> wrote:
>
>> On Thu, Nov 28, 2019 at 01:30:26PM +0100, Alexander Burger wrote:
>> >    (de f (Names)
>> >       (pilog
>> >          (quote
>> >             @Names Names
>> >             @Gen (mapcan '((Nm) (list 'nm '+TagVal Nm)) Names)
>> >             (select (@Item)
>> >                ((@Gen (v +Tag) itm))
>> >                ...
>>
>> Haha, it just occurs to me that we made a stupid mistake!
>>
>> As we are searching for objects that have ALL names (i.e. an AND of all
>> names in
>> the list), searching the index multiple times (once for each element in
>> the
>> list) in very inefficient and unnecessary :)
>>
>> Instead, we can pick any element of the list, e.g. the CAR:
>>
>>    (de f (Names)
>>       (pilog
>>          (quote
>>             @Names Names
>>             @Key (car Names)
>>             (select (@Item)
>>                ((nm +TagVal @Key (v +Tag) itm))
>>                ...
>>
>> ☺/ A!ex
>>
>> --
>> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>>
>

Reply via email to