Re: +QueryChart without pilog

2019-12-04 Thread Alexander Burger
Hi Kashyap,

On Tue, Dec 03, 2019 at 07:48:58PM -0800, C K Kashyap wrote:
> I'll need a little bit more help with Pilog in QueryChart - In the code
> below,

Could you in the future provide code which is formatted in a more readable way?
It is very hard to decipher. Better no spaces between lines, and indentations
and parentheses more to the standard (see the output of 'pretty' and 'pp').

If I try to fix it manually, I get (hope I did not destroy anything):

   (diaform '(Dst)
  ( "--"
 "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  # Commented?
 '((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  # T?
  (; (-> @@) tgs) ) )
(-> @Names) ) ) ) ) )
 1
 '((This) (list This)) )

(I assume the quotes, T etc. are temporary tests)


> I get the tags as a list of space separated words in the *Tags
> variable.

That's all right, but better may be to use +ListTextField, it directly returns a
list of strings:

   "Tags" (gui 'tags '(+ListTextField) '("," " ") 20)


> 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?

Sorry, I don't understand this. In which way does @Gen "use" @Names?

☺/ A!ex

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


Re: +QueryChart without pilog

2019-12-04 Thread C K Kashyap
Thanks Alex,
Sure, I'll do a pp in future - also start following that conventions.

About @Gen using @Names - the second argument of mapcan in the definition
of @Gen is essentially @Names. I am looking for a way to avoid having to
repeat the expression (filter ...


(gui

  'query

  '(+QueryChart)

  *ROWS

  '(goal

 '(@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) (member Nm (: nm nm)))

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

 (-> @Names) ) ) ) ) )

  1

  '((This) (list This)) )




Regards,
Kashyap

On Wed, Dec 4, 2019 at 3:07 AM Alexander Burger  wrote:

> Hi Kashyap,
>
> On Tue, Dec 03, 2019 at 07:48:58PM -0800, C K Kashyap wrote:
> > I'll need a little bit more help with Pilog in QueryChart - In the code
> > below,
>
> Could you in the future provide code which is formatted in a more readable
> way?
> It is very hard to decipher. Better no spaces between lines, and
> indentations
> and parentheses more to the standard (see the output of 'pretty' and 'pp').
>
> If I try to fix it manually, I get (hope I did not destroy anything):
>
>(diaform '(Dst)
>   ( "--"
>  "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  # Commented?
>  '((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  # T?
>   (; (-> @@) tgs) ) )
> (-> @Names) ) ) ) ) )
>  1
>  '((This) (list This)) )
>
> (I assume the quotes, T etc. are temporary tests)
>
>
> > I get the tags as a list of space separated words in the *Tags
> > variable.
>
> That's all right, but better may be to use +ListTextField, it directly
> returns a
> list of strings:
>
>"Tags" (gui 'tags '(+ListTextField) '("," " ") 20)
>
>
> > 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?
>
> Sorry, I don't understand this. In which way does @Gen "use" @Names?
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: +QueryChart without pilog

2019-12-04 Thread C K Kashyap
Okay, I have a working version but I think I should be able to do it more
elegantly. I have the complete choTask function below (pretty printed
ofcourse :) ) I have the repeating pattern as XXX which I replace using
patch -

(patch choTask 'XXX '(filter '((X) X) (mapcar '((X) (uppc (pack X)))
*Tags)))
Which works but seems to me like I am not using "macros" correctly.


(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

   XXX

   @Gen

   (mapcan

  '((Nm) (list 'nm '+TagNm Nm))

  'XXX )

   (select

  (@@)

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

  (^

 @

 (fully

'((Nm)

   (find

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

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

(-> @Names) ) ) ) ) )

 1

 '((This) (list This)) )

  (

 NIL

 (choTtl "Entries" '+Task)

 '(("em20 align" "Name"))

 (do *ROWS

(

   NIL

   (gui 1 '(+ObjView +TextField) '(: ttl)) ) ) )

  ( (scroll *ROWS) (newButton T Dst '(+Task))) ) )


On Wed, Dec 4, 2019 at 5:43 AM C K Kashyap  wrote:

> Thanks Alex,
> Sure, I'll do a pp in future - also start following that conventions.
>
> About @Gen using @Names - the second argument of mapcan in the definition
> of @Gen is essentially @Names. I am looking for a way to avoid having to
> repeat the expression (filter ...
>
>
> (gui
>
>   'query
>
>   '(+QueryChart)
>
>   *ROWS
>
>   '(goal
>
>  '(@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) (member Nm (: nm nm)))
>
>(; (-> @@) tgs) ) )
>
>  (-> @Names) ) ) ) ) )
>
>   1
>
>   '((This) (list This)) )
>
>
>
>
> Regards,
> Kashyap
>
> On Wed, Dec 4, 2019 at 3:07 AM Alexander Burger 
> wrote:
>
>> Hi Kashyap,
>>
>> On Tue, Dec 03, 2019 at 07:48:58PM -0800, C K Kashyap wrote:
>> > I'll need a little bit more help with Pilog in QueryChart - In the code
>> > below,
>>
>> Could you in the future provide code which is formatted in a more
>> readable way?
>> It is very hard to decipher. Better no spaces between lines, and
>> indentations
>> and parentheses more to the standard (see the output of 'pretty' and
>> 'pp').
>>
>> If I try to fix it manually, I get (hope I did not destroy anything):
>>
>>(diaform '(Dst)
>>   ( "--"
>>  "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  # Commented?
>>  '((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  # T?
>>   (; (-> @@) tgs) ) )
>> (-> @Names) ) ) ) ) )
>>  1
>>  '((This) (list This)) )
>>
>> (I assume the 

Re: +QueryChart without pilog

2019-12-04 Thread Alexander Burger
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


Re: +QueryChart without pilog

2019-12-04 Thread Alexander Burger
Hi Kashyap,

> (de choTask (Dst)
> 
>(diaform
> 
>   '(Dst)
> 
>   (
> 
>  "--"
> 
>  "Name"
> 
>  (gui
> 
> 'ttl
> 
> '(+DbHint +Var +TextField)
> 
> '(ttl +Task)

Hmm, OK, perhaps not to *that* extreme. 'pretty' was not a good advice in this
case (I meant more the line spacing, indentation and parentheses). A better
guide are simply the existing examples.

But why are all lines spread out so much? Is it your mail client? To see what I
see, you could check

   https://www.mail-archive.com/picolisp@software-lab.de/msg09262.html

It is unreadable imho.

☺/ A!ex

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