Oleg, your example is great!
With a little tinkering, I, who know NOTHING about windows programming, was
able
to get your Index Array Operations screen to show both the index array and the
result in the Result window, lengthening the Result window to make room for
longer answers -- that's a tribute to the "expressive" part of your "economical
and expressive" below.
What I see is that elementary J windows programming requires an ability to do J
array programming plus an ability to manage screens (forms? windows?) with the
Form Editor. You had to identify the shape of the index array as the key
parameter, then build your form on that base.
Looking through the "System" labs I find a Form Editor lab and a Building
Applications lab, presumably to be taken up in that order.
I'm guessing UI means "user interface".
Thanks for an illuminating "elevator conversation".
Oleg Kobchenko wrote:
> OK. So mean like an Elevator Conversation kinda thing.
>
> There are some one-line helper GUI utilities
> to show info or ask simple questions:
>
> wdinfo 'Title';'2 + 2 = ',":2+2 NB. shows an info box
>
> wdquery 'Title';'Proceed?' NB. shows OK/Cancel box
>
> wdselect 'Title';<;:'One Two Three' NB. choice box
>
> Then there's a Window Driver system which helps
> build fairly sophisticated UI screens and interactions
> in an economical yet expressive way. The driver provides
> a set of commands to create a form layout with controls
> and means to communicate with the controls: setting and getting
> values, parameters, etc. When an event occurs, a user-defined
> handler is found based on naming conventions and the current
> control values are made available as variable in the form locale.
>
> Here's an example that translates Kip Murray's flavors to UI.
> The layout is built using the friendly Form Editor.
>
> NB. =========================================================
> NB. ui flavors - simple J operations using window driver
>
> LAYOUT=: 0 : 0
> pc f;pn "Index Array Operations";
> xywh 132 30 60 12;cc Iota button;cn "Index Array";
> xywh 132 50 60 12;cc ItemSum button;cn "Item Sum";
> xywh 132 70 60 12;cc PatialSums button;cn "Patial Sums";
> xywh 6 8 50 11;cc s1 static;cn "Shape";
> xywh 66 7 60 12;cc Shape edit;
> xywh 5 30 120 120;cc Result editm;
> pas 6 6;pcenter;
> rem form end;
> )
>
> f_run=: 3 : 0
> wd LAYOUT NB. define form layout
> wd 'set Shape *3 4' NB. initialize some values
> wd 'setfont Result ',FIXFONT
> wd 'pshow;'
> )
>
> f_close=: 3 : 0
> wd'pclose'
> )
> NB. utility code
>
> flatstr=: ,@:(,&(10{a.)"1)"2^:(0 >. #...@$ - 1:)
>
> calc=: 1 : 0
> flatstr ": u ". y
> )
> NB. event handling
>
> f_Iota_button=: 3 : 0
> wd'set Result *', i. calc Shape
> )
>
> f_ItemSum_button=: 3 : 0
> wd'set Result *', +/@i. calc Shape
> )
>
> f_PatialSums_button=: 3 : 0
> wd'set Result *', +/\...@i. calc Shape
> )
>
> f_run''
>
> NB. =========================================================
>
>
>
>
>> From: Kip Murray <[email protected]>
>>
>> In array programming, the J programmer learns to formulate his problems in
>> terms
>>
>> of functions, operators and arrays -- that level of abstraction -- as
>> illustrated in my 12 September "Flavor of J" post in the Programming forum.
>> I
>> am looking for an analogous discussion of J windows programming. Your
>> discussion and example can be for a newcomer to windows programming, or for
>> an
>> experienced programmer who is considering J -- your choice!
>>
>> Oleg Kobchenko wrote:
>>> Can you provide a few examples how "flavors" are specified or described
>>> in other frameworks? 'Cause this is too general.
>>>
>>>
>>>
>>> ----- Original Message ----
>>>> From: Kip Murray
>>>>
>>>> How do you describe the "flavor" of J windows programming? "Flavor" has
>>>> to
>> do
>>>> with ingredients and recipes: how does a J windows programmer
>>>> conceptualize
>> his
>>>> problems? Can you give a description and an introductory example?
>
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm