Re: +QueryChart without pilog

2019-12-05 Thread C K Kashyap
Okay, my choTask looks like this now - as you can see, I assigned a list
to @Names and then assigned the 'car' of the list to @Key. The way I
avoided repetition was by assigning to a global symbol '*Names' - is that
reasonable?

 
 "Tags" (gui 'tags '(+Var +ListTextField) '*Tags '("," " ") 20 )
 (searchButton '(init> (: home query))) )
  (gui 'query '(+QueryChart) *ROWS
 '(goal
'( @Names (setq *Names (filter prog (mapcar '((X) (uppc (pack
X))) *Tags) ) )
   @Key (car *Names)
   (select (@@)
  ((nm +TagNm @Key (nm +Tag) tsk))
  (^ @
 (fully '((Nm)
   (find
  '((This) (member Nm (: nm nm)))
  (; (-> @@) tgs) ) )
(-> @Names) ) ) ) ) )
 1
 '((This) (list This)) )
  ( ...

Regards,
Kashyap

On Thu, Dec 5, 2019 at 10:36 AM C K Kashyap  wrote:

> Super! .. thanks Alex,
> Regards,
> Kashyap
>
> On Thu, Dec 5, 2019 at 9:23 AM Alexander Burger 
> wrote:
>
>> On Thu, Dec 05, 2019 at 08:34:34AM -0800, C K Kashyap wrote:
>> > About the "filtering with a no-op" - that was my way of getting rid of
>> > NIL's in the list - what's the right way :) ?
>>
>> Ah, yes, sure! A valid solution!
>>
>> I just did not trigger on that pattern, because I use (filter prog Lst),
>> or
>> sometimes (filter bool Lst) for that without further thinking.
>>
>> ((X) X) has a high overhead due to the EXPR function call. It binds and
>> unbinds
>> the X parameter, and runs the (almost empty) body between that.
>>
>> 'prog' is the ideal no-op function, as it evaluates all arguments, does
>> nothing else, and is a built-in and fast as such.
>>
>> ☺/ A!ex
>>
>> --
>> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>>
>


Re: +QueryChart without pilog

2019-12-05 Thread C K Kashyap
Super! .. thanks Alex,
Regards,
Kashyap

On Thu, Dec 5, 2019 at 9:23 AM Alexander Burger  wrote:

> On Thu, Dec 05, 2019 at 08:34:34AM -0800, C K Kashyap wrote:
> > About the "filtering with a no-op" - that was my way of getting rid of
> > NIL's in the list - what's the right way :) ?
>
> Ah, yes, sure! A valid solution!
>
> I just did not trigger on that pattern, because I use (filter prog Lst), or
> sometimes (filter bool Lst) for that without further thinking.
>
> ((X) X) has a high overhead due to the EXPR function call. It binds and
> unbinds
> the X parameter, and runs the (almost empty) body between that.
>
> 'prog' is the ideal no-op function, as it evaluates all arguments, does
> nothing else, and is a built-in and fast as such.
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: +QueryChart without pilog

2019-12-05 Thread Alexander Burger
On Thu, Dec 05, 2019 at 08:34:34AM -0800, C K Kashyap wrote:
> About the "filtering with a no-op" - that was my way of getting rid of
> NIL's in the list - what's the right way :) ?

Ah, yes, sure! A valid solution!

I just did not trigger on that pattern, because I use (filter prog Lst), or
sometimes (filter bool Lst) for that without further thinking.

((X) X) has a high overhead due to the EXPR function call. It binds and unbinds
the X parameter, and runs the (almost empty) body between that.

'prog' is the ideal no-op function, as it evaluates all arguments, does
nothing else, and is a built-in and fast as such.

☺/ A!ex

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


Re: +QueryChart without pilog

2019-12-05 Thread C K Kashyap
Thanks Alex,

About the "filtering with a no-op" - that was my way of getting rid of
NIL's in the list - what's the right way :) ?

Regards,
Kashyap

On Thu, Dec 5, 2019 at 7:50 AM Alexander Burger  wrote:

> Hi Kashyap,
>
> > The question I have now is about cases where we may need a couple of
> pilog
> > variables of the form -
> >  @Names XXX
> >  @Gen (mapcan '((Nm) (list 'nm '+TagNm Nm)) 'XXX)
> >
> > where XXX needs to be substituted with an expression - (filter '((X) X)
> > (mapcar '((X) (uppc (pack X)))  *Tags))) in this case. As I was
> > experimenting for writing this email, using function calls to do the
> > "substitution" seems to work. For some reason, it was not working for me
> > when I tried yesterday.
>
> Yeah, this should be no general problem. In all those patterns
>
>@Var (expression)
>
> (expression) is an arbitrary Lisp expression, so you are completely free
> to call
> other functions etc.
>
>
> > This seems to work too -
> > '(
> >@Names (YY)
> >@Gen (mapcan '((Nm) (list 'nm '+TagNm Nm)) '(YY T))
> >(select (@@)
> > ((@Gen (nm +Tag) tsk))
> > (^ @
> >  (fully
> >   '((Nm)
> >   (find
> >'((This) (member Nm (: nm nm)))
> >(; (-> @@) tgs) ) )
> >   (-> @Names) ) )
> >)
> > )
> >
> > where YY is defined as -
>
> Well, in the above @Gen expression, 'YY' is used as a *name* in the quoted
> list,
> so it does not matter if and how it is defined.
>
> Or is the quote wrong?
>
>
> > (de YY (QT)
> > (filter '((X) X) (mapcar '((X) (uppc (pack X)))  *Tags)))
> > One thing odd I find is that the code "does not work" when I call YY with
> > NIL or without an argument in the second case (@Gen)
>
> The 'QT' parameter is ignored anyway.
>
> Side note: Why do you filter with a no-op function? Or is this just a
> placeholder for testing?
>
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: +QueryChart without pilog

2019-12-05 Thread Alexander Burger
Hi Kashyap,

> The question I have now is about cases where we may need a couple of pilog
> variables of the form -
>  @Names XXX
>  @Gen (mapcan '((Nm) (list 'nm '+TagNm Nm)) 'XXX)
> 
> where XXX needs to be substituted with an expression - (filter '((X) X)
> (mapcar '((X) (uppc (pack X)))  *Tags))) in this case. As I was
> experimenting for writing this email, using function calls to do the
> "substitution" seems to work. For some reason, it was not working for me
> when I tried yesterday.

Yeah, this should be no general problem. In all those patterns

   @Var (expression)

(expression) is an arbitrary Lisp expression, so you are completely free to call
other functions etc.


> This seems to work too -
> '(
>@Names (YY)
>@Gen (mapcan '((Nm) (list 'nm '+TagNm Nm)) '(YY T))
>(select (@@)
> ((@Gen (nm +Tag) tsk))
> (^ @
>  (fully
>   '((Nm)
>   (find
>'((This) (member Nm (: nm nm)))
>(; (-> @@) tgs) ) )
>   (-> @Names) ) )
>)
> )
> 
> where YY is defined as -

Well, in the above @Gen expression, 'YY' is used as a *name* in the quoted list,
so it does not matter if and how it is defined.

Or is the quote wrong?


> (de YY (QT)
> (filter '((X) X) (mapcar '((X) (uppc (pack X)))  *Tags)))
> One thing odd I find is that the code "does not work" when I call YY with
> NIL or without an argument in the second case (@Gen)

The 'QT' parameter is ignored anyway.

Side note: Why do you filter with a no-op function? Or is this just a
placeholder for testing?


☺/ A!ex

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


Re: +QueryChart without pilog

2019-12-05 Thread C K Kashyap
Oh! ... now I see the spacing problem .. sorry about that, I think it must
be the result of copying from the terminal and pasting.

The last proposal was perfect - indeed it works just fine for tags (I've
tried different pasting this time).

(de choTask (Dst)
   (diaform '(Dst)
( "--"
 "Name" (gui 'ttl '(+DbHint +Var +TextField) '(ttl
+Task) '*Name 20)
 "Tags" (gui 'tags '(+Var +ListTextField) '*Tags
'(","," ") 20)
 (searchButton '(init> (: home query)))
 )
(gui 'query '(+QueryChart) *ROWS
   '(goal
 '(
 @Names (filter '((X) X) (mapcar '((X) (uppc (pack
X)))  *Tags))
 @Key (car (filter '((X) X) (mapcar '((X) (uppc
(pack X))) *Tags)))
 (select (@@)
  ((nm +TagNm @Key (nm +Tag) tsk))
  (^ @
   (fully
'((Nm)
(find
 '((This) (member Nm (: nm nm)))
 (; (-> @@) tgs) ) )
(-> @Names) ) )


The question I have now is about cases where we may need a couple of pilog
variables of the form -
 @Names XXX
 @Gen (mapcan '((Nm) (list 'nm '+TagNm Nm)) 'XXX)

where XXX needs to be substituted with an expression - (filter '((X) X)
(mapcar '((X) (uppc (pack X)))  *Tags))) in this case. As I was
experimenting for writing this email, using function calls to do the
"substitution" seems to work. For some reason, it was not working for me
when I tried yesterday.

This seems to work too -
'(
   @Names (YY)
   @Gen (mapcan '((Nm) (list 'nm '+TagNm Nm)) '(YY T))
   (select (@@)
((@Gen (nm +Tag) tsk))
(^ @
 (fully
  '((Nm)
  (find
   '((This) (member Nm (: nm nm)))
   (; (-> @@) tgs) ) )
  (-> @Names) ) )
   )
)

where YY is defined as -
(de YY (QT)
(filter '((X) X) (mapcar '((X) (uppc (pack X)))  *Tags)))

One thing odd I find is that the code "does not work" when I call YY with
NIL or without an argument in the second case (@Gen)

I think I'll have to do some more experiments to come up with precise
questions. In the meantime, the tags logic works for me :)


Regards,
Kashyap



On Wed, Dec 4, 2019 at 10:53 PM Alexander Burger 
wrote:

> On Wed, Dec 04, 2019 at 02:32:57PM -0800, C K Kashyap wrote:
> > (patch choTask 'XXX '(filter '((X) X) (mapcar '((X) (uppc (pack X)))
> > *Tags)))
> > ...
>
> I do not understand your intention. I thougt you wanted an AND of all
> tags, so
> the @Gen generator was obsolete.
>
> My last proposal was:
>
> (de f (Names)
>(pilog
>   (quote
>  @Names Names
>  @Key (car Names)
>  (select (@Item)
> ((nm +TagVal @Key (v +Tag) itm))
> (^ @
>(fully
>   '((Nm)
>  (find
> '((This) (member Nm (: v nm)))
> (; (-> @Item) tgs) ) )
>   (-> @Names) ) ) ) )
>   (print-item @Item) ) )
>
>(f '("RED" "BLUE"))
>
> What was wrong with it?
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>