Now that I can count better, here is an explicit version for combinations:
comb1=: ((= +/"1) |.@:I.@# ]) #:@i.@(2&^) comb5=: 13 :'(x=+/"1 #:i.2^y) ([:|.[:I.#) #:i.2^y' 2 comb5 4 0 1 0 2 0 3 1 2 1 3 2 3 comb5 ([ = [: +/"1 [: #: [: i. 2 ^ ]) ([: |. [: I. #) [: #: [: i. 2 ^ ] This is getting closer to providing Ric's tacit version: comb4=: [ (([ = [: +/"1 ]) ([: |. [: I. #) ]) [: #: [: i. 2 ^ ] Linda -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Roger Hui Sent: Wednesday, June 12, 2013 11:23 AM To: Programming forum Subject: Re: [Jprogramming] z458095869_dissectnopath_ c=: 'comb4=: [ (([ = [: +/"1 ]) ([: |. [: I. #) ]) [: #: [: i. 2 ^ ]' +/\ 1 _1 0{~ '()' i. c 0 0 0 0 0 0 0 0 0 0 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 c,:1":+/\ 1 _1 0{~ '()' i. c comb4=: [ (([ = [: +/"1 ]) ([: |. [: I. #) ]) [: #: [: i. 2 ^ ] 000000000012222222222222211222222222222221110000000000000000000 The parens look matched to me. On Wed, Jun 12, 2013 at 7:59 AM, Linda Alvord <[email protected]>wrote: > Ric, Look closely at the display of comb4 (whichav works). Have > you cever seen a function with unmatched parentheses? > > comb4=: [ (([ = [: +/"1 ]) ([: |. [: I. #) ]) [: #: [: i. 2 ^ ] > 2 comb4 4 > 0 1 > 0 2 > 0 3 > 1 2 > 1 3 > 2 3 > > comb4 > [ (([ = [: +/"1 ]) ([: |. [: I. #) ]) [: #: [: i. 2 ^ ] > > > Now look at the definition I want to write: > > comb5=: 13 :'((x=+/"1 y) (|.I.#) #:i.2^y' > > comb5 > 4 : '((x=+/"1 y) (|.I.#) #:i.2^y' > > 2 comb5 4 > |syntax error: comb5 > | ((x=+/"1 y)(|.I.#)#:i.2^y > > > My explicit comb5 is the one I want to work. It shows the structure > of combinations beautifully: > > > x (f g h) y evaluates as (x f y) g (x h y) > > Linda > > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Linda > Alvord > Sent: Wednesday, June 12, 2013 10:20 AM > To: [email protected] > Subject: Re: [Jprogramming] z458095869_dissectnopath_ > > Ric, comb3 works, but when you display the definition it inserts a > set of parentheses that are necessary to determine the order of > operation. Can you make your version work with doing that? > > comb2=: 13 :'|. I. (x=+/"1 #:i.2^y)##:i.2^y' > > comb3=: ((= +/"1) ([: |. [: I. #) ]) [: #: [: i. 2 ^ ] > 2 comb3 4 > 0 1 > 0 2 > 0 3 > 1 2 > 1 3 > 2 3 > > comb2 > [: |. [: I. ([ = [: +/"1 [: #: [: i. 2 ^ ]) # [: #: [: i. 2 ^ ] > > comb3 > ((= +/"1) ([: |. [: I. #) ]) ([: #: [: i. 2 ^ ]) > > I haven't worked on comb4 yet, but I'm looking forward to it. > > Linda > > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Ric > Sherlock > Sent: Tuesday, June 11, 2013 6:31 AM > To: Programming JForum > Subject: Re: [Jprogramming] z458095869_dissectnopath_ > > Linda, > In case it is of any interest to you, the following is a more faithful > translation of the original comb1 to a tacit form without @ @: or & > comb3=: ((= +/"1) ([: |. [: I. #) ]) ([: #: [: i. 2 ^ ]) > > If you also want to remove hooks then ... > comb4=: [ (([ = [: +/"1 ]) ([: |. [: I. #) ]) [: #: [: i. 2 ^ ] > > Have you tried creating tacit forms without using 13 : ? If not I'd > encourage you to give it a go! > > > On Tue, Jun 11, 2013 at 7:56 PM, Linda Alvord > <[email protected]>wrote: > > > It took quite a while to remove @ @: & from Roger's great > > combinations function and I learned a lot. You may find these > comparisons fun. > > > > If you try this script in J801 jhs then use NB. to ignore the two > > ds statements > > > > > > require '~addons/debug/dissect/dissect.ijs' > > > > comb1=: ((= +/"1) |.@:I.@# ]) #:@i.@(2&^) > > 2 comb1 4 > > comb1 > > > > comb2=: 13 :'|. I. (x=+/"1 #:i.2^y)##:i.2^y' > > 2 comb2 4 > > comb2 > > > > ds '2([: |. [: I. ([ = [: +/"1 [: #: [: i. 2 ^ ]) # [: #: [: i. 2 ^ ])4' > > > > ds '2(((= +/"1) |.@:I.@# ]) #:@i.@(2&^))4' > > > > 5!:4 <'comb1' > > > > 5!:4 <'comb2' > > > > Linda > > > > > > -----Original Message----- > > From: [email protected] > > [mailto:[email protected]] On Behalf Of Linda > > Alvord > > Sent: Friday, June 07, 2013 3:55 PM > > To: [email protected] > > Subject: Re: [Jprogramming] z458095869_dissectnopath_ > > > > Here's another happy story about frequency distributions. > > > > require '~addons/debug/dissect/dissect.ijs' > > > > ]A=:?4 5$6 > > > > fd=: 13 :'/:~({.,#)/.~,y' > > fd A > > > > fd2=: 13 :'/:~ (,y)({.,#)/.,y' > > fd2 A > > > > fd > > fd2 > > > > ds '([: /:~ , ({. , #)/. ,)?4 5$6' > > ds '([: /:~ [: ({. , #)/.~ ,)?4 5$6' > > > > Enter the script above. I never understood fd until today. > > Looking at your ds version allowed me to write an explicit > > version. The tacit result was even shorter! It continues to be a > > kind of miracle tool. > > > > The newer ds is an improvement too. > > > > Linda > > > > -----Original Message----- > > From: [email protected] > > [mailto:[email protected]] On Behalf Of Henry > > Rich > > Sent: Thursday, June 06, 2013 10:12 AM > > To: [email protected] > > Subject: Re: [Jprogramming] z458095869_dissectnopath_ > > > > You can use a function in a function; ds just won't look inside the name. > > > > Henry Rich > > > > On 6/6/2013 2:02 AM, Linda Alvord wrote: > > > Henry, Earlier I thought I couldn't use a function inside another > > > function, but it seems now that I can. > > > > > > require '~addons/debug/dissect/dissect.ijs' > > > > > > pas=: 13 :'(i.>:y)!y' > > > > > > NB. BINOMIAL PROBABILITIES > > > bp=: 13 :' (pas x)*(y^ i.>:x)*(1-y)^ |. i.>:x' > > > > > > ds 'pas 3' > > > ds '3(([: pas [) * (] ^ [: i. [: >: [) * (1 - ]) ^ [: |. [: i. [: >: > > [)0.9' > > > > > > Linda > > > > > > -----Original Message----- > > > From: [email protected] > > > [mailto:[email protected]] On Behalf Of > > > Linda Alvord > > > Sent: Wednesday, June 05, 2013 9:54 PM > > > To: [email protected] > > > Subject: Re: [Jprogramming] z458095869_dissectnopath_ > > > > > > I just realized what I did. By mistake I wrote ds=: and > > > realized it and knew I had to restart jqt. When I did all was fine. > > > > > > Sorry to bother you. > > > > > > Linda > > > > > > > > > -----Original Message-----d > > > Froam: [email protected] > > > [mailto:[email protected]] On Behalf Of > > > Henry Rich > > > Sent: Wednesday, June 05, 2013 9:26 PM > > > To: [email protected] > > > Subject: Re: [Jprogramming] z458095869_dissectnopath_ > > > > > > Are you sure? When I run > > > > > > ds '2([: |: ([ = [: +/ [: |: #~ #: [: i. ^) #"1 [: |: #~ #: [: i. ^)4' > > > > > > I get a valid display. There seems to be a weird () following the > > > 2 in your version. > > > > > > Henry Rich > > > > > > On 6/5/2013 9:19 PM, Linda Alvord wrote: > > >> Henry, I used your ds version of cr and used it to rewrite a > > >> shorter version of cr. > > >> > > >> require '~addons/debug/dissect/dissect.ijs' > > >> > > >> cr=: 13 :'|:(x= +/ |:(y#x)#:i.x^y) #"1 |:(y#x)#:i.x^y' > > >> cr > > >> [: |: ([ = [: +/ [: |: #~ #: [: i. ^) #"1 [: |: #~ #: [: i. ^ > > >> > > >> 2 cr 4 > > >> 0 0 1 1 > > >> 0 1 0 1 > > >> 0 1 1 0 > > >> 1 0 0 1 > > >> 1 0 1 0 > > >> 1 1 0 0 > > >> > > >> ds '2([: |: ([ = [: +/ [: |: #~ #: [: i. ^) #"1 [: |: #~ #: [: i. > > ^)4' > > >> |syntax error: ds > > >> | 2()[:|:([=[:+/[:|:#~#:[:i.^)#"1[:|:#~#:[:i.^)4 > > >> > > >> Something in the new version is not working. > > >> > > >> Linda > > >> > > >> -----Original Message----- > > >> From: [email protected] > > >> [mailto:[email protected]] On Behalf Of > > >> Linda Alvord > > >> Sent: Wednesday, June 05, 2013 7:59 PM > > >> To: [email protected] > > >> Subject: Re: [Jprogramming] z458095869_dissectnopath_ > > >> > > >> Henry, After an upgrade a click on an array in a red box will > > >> appear in a grid. Now hist 8 appears in the grid with a scroll bar. > > > Impressive. > > >> > > >> Also, 2 cr 5 > > >> > > >> Thanks. I'm already finding ds useful. Linda > > >> > > >> > > >> -----Original Message----- > > >> From: [email protected] > > >> [mailto:[email protected]] On Behalf Of > > >> Henry Rich > > >> Sent: Wednesday, June 05, 2013 11:57 AM > > >> To: [email protected] > > >> Subject: Re: [Jprogramming] z458095869_dissectnopath_ > > >> > > >> I have fixed the errors you found, in cr and in launching a grid. > > >> > > >> Henry Rich > > >> > > >> On 6/5/2013 3:04 AM, Linda Alvord wrote: > > >>> I'm working on simplifying cr but here is what happens now. > > >>> > > >>> cr=:[: |: ([ = [: +/ [: ([: |: ] #: [: i. */) 2 $~ ]) #"1 [: > ([: > > >>> |: ] > > >> #: > > >>> [: i. */) 2 $~ ] > > >>> 2 cr 4 > > >>> 0 0 1 1 > > >>> 0 1 0 1 > > >>> 0 1 1 0 > > >>> 1 0 0 1 > > >>> 1 0 1 0 > > >>> 1 1 0 0 > > >>> ds '2 ([: |: ([ = [: +/ [: ([: |: ] #: [: i. */) 2 $~ ]) #"1 [: > > >>> ([: |: ] > > >>> #: [: i. */) 2 $~ ])4' > > >>> length error > > >>> |length error: combineheights > > >>> | estheights=:estheights__vop combineheights estheights__uop > > >>> > > >>> unknown error during parsing > > >>> > > >>> Probably you will spot right away why ds is unhappy. > > >>> > > >>> Linda > > >>> -----Original Message----- > > >>> From: [email protected] > > >>> [mailto:[email protected]] On Behalf Of > > >>> Linda Alvord > > >>> Sent: Wednesday, June 05, 2013 2:16 AM > > >>> To: [email protected] > > >>> Subject: Re: [Jprogramming] z458095869_dissectnopath_ > > >>> > > >>> Here's a shorter route to the same problem: > > >>> > > >>> require '~addons/debug/dissect/dissect.ijs' > > >>> > > >>> hist=: 13 :''' O''{~((i.>:y)!y)>/i.>./(i.>:y)!y' > > >>> hist > > >>> > > >>> hist 8 > > >>> > > >>> ds '('' O'' {~ (] !~ [: i. >:) >/ [: i. [: >./ ] !~ [: i. >:)8' > > >>> > > >>> Linda > > >>> > > >>> -----Original Message----- > > >>> From: [email protected] > > >>> [mailto:[email protected]] On Behalf Of > > >>> Linda Alvord > > >>> Sent: Wednesday, June 05, 2013 1:36 AM > > >>> To: [email protected] > > >>> Subject: Re: [Jprogramming] z458095869_dissectnopath_ > > >>> > > >>> Henry, > > >>> > > >>> I get an error box if I click on the data in an error box in red: > > >>> > > >>> --------------------------- > > >>> wdhandler > > >>> --------------------------- > > >>> error in: dissect_dissectisi_mbldown > > >>> > > >>> xywh : command not found: wd > > >>> (wd ::(''"_)'qer') (13!:8)3 > > >>> --------------------------- > > >>> OK > > >>> > > >>> If I look in the Term window this message is repeated quite a > > >>> few > > times. > > >>> > > >>> > > >>> error in paint > > >>> assertion failure > > >>> |assertion failure: initevents > > >>> | 0~:GRIDHWNDC > > >>> > > >>> Clicking on data in red boxes doesn't work > > >>> > > >>> --------------------------- > > >>> wdhandler > > >>> --------------------------- > > >>> error in: dissect_dissectisi_mbldown > > >>> > > >>> xywh : command not found: wd > > >>> (wd ::(''"_)'qer') (13!:8)3 > > >>> --------------------------- > > >>> OK > > >>> > > >>> > > >>> error in paint > > >>> assertion failure > > >>> |assertion failure: initevents > > >>> | 0~:GRIDHWNDC > > >>> > > >>> > > >>> JVERSION > > >>> Engine: j701/2011-01-10/11:25 > > >>> Library: 8.01.011 > > >>> Qt IDE: 1.0.10 > > >>> Platform: Win 32 > > >>> Installer: j801 beta install > > >>> InstallPath: c:/users/owner/j801 > > >>> > > >>> All files are upgraded and installed. > > >>> > > >>> Maybe this helps. > > >>> > > >>> Linda > > >>> > > >>> -----Original Message----- > > >>> From: [email protected] > > >>> [mailto:[email protected]] On Behalf Of > > >>> Henry Rich > > >>> Sent: Tuesday, June 04, 2013 9:43 PM > > >>> To: [email protected] > > >>> Subject: Re: [Jprogramming] z458095869_dissectnopath_ > > >>> > > >>> The result's not too large. It's just not all displayed. The > > >>> red border around the value is the clue that the value has been > > >>> truncated for > > >> display. > > >>> When you see that, you can click on the truncated value to get a > > >>> grid that will show you the entire value. > > >>> > > >>> Henry Rich > > >>> > > >>> On 6/4/2013 9:41 PM, Linda Alvord wrote: > > >>>> Henry, What I meant was the error that begins when ds > > >>>> indicates a list of length 70 and only shows a 27 element > > >>>> list. Then the final table claims shape 9 70 but only shows 9 27. > > >>>> > > >>>> Shouldn't there be a message like "result too large" or something? > > >>>> > > >>>> Linda > > >>>> > > >>>> -----Original Message----- > > >>>> [mailto:[email protected]] > > >>>> On Behalf Of Henry Rich > > >>>> Sent: Tuesday, June 04, 2013 2:53 PM > > >>>> To: [email protected] > > >>>> Subject: Re: [Jprogramming] z458095869_dissectnopath_ > > >>>> > > >>>> OK, I have fixed the grid display. When you have an oversize > > >>>> result, clicking on it launches a grid to display the entire result. > > >>>> > > >>>> Linda, is this what you meant by 'beyond the capacity of ds'? > > >>>> > > >>>> Henry Rich > > >>>> > > >>>> On 6/4/2013 12:00 AM, Raul Miller wrote: > > >>>>> Perhaps ds should have scrollbars for displaying large things? > > >>>>> (Though ideally this should go in wd's implementation, at > > >>>>> least as an option, and screen resources for things not in > > >>>>> view could perhaps be avoided. I'm thinking of something like > > >>>>> the css > > >>>>> overflow: scroll mechanism for html.) > > >>>>> > > >>>> --------------------------------------------------------------- > > >>>> -- > > >>>> -- > > >>>> - > > >>>> - > > >>>> - For information about J forums see > > >>>> http://www.jsoftware.com/forums.htm > > >>>> > > >>>> --------------------------------------------------------------- > > >>>> -- > > >>>> -- > > >>>> - > > >>>> - > > >>>> - For information about J forums see > > >>>> http://www.jsoftware.com/forums.htm > > >>>> > > >>> ---------------------------------------------------------------- > > >>> -- > > >>> -- > > >>> - > > >>> - For information about J forums see > > >>> http://www.jsoftware.com/forums.htm > > >>> > > >>> ---------------------------------------------------------------- > > >>> -- > > >>> -- > > >>> - > > >>> - For information about J forums see > > >>> http://www.jsoftware.com/forums.htm > > >>> > > >>> ---------------------------------------------------------------- > > >>> -- > > >>> -- > > >>> - > > >>> - For information about J forums see > > >>> http://www.jsoftware.com/forums.htm > > >>> > > >>> ---------------------------------------------------------------- > > >>> -- > > >>> -- > > >>> - > > >>> - For information about J forums see > > >>> http://www.jsoftware.com/forums.htm > > >>> > > >> ----------------------------------------------------------------- > > >> -- > > >> -- > > >> - For information about J forums see > > >> http://www.jsoftware.com/forums.htm > > >> > > >> ----------------------------------------------------------------- > > >> -- > > >> -- > > >> - For information about J forums see > > >> http://www.jsoftware.com/forums.htm > > >> > > >> ----------------------------------------------------------------- > > >> -- > > >> -- > > >> - For information about J forums see > > >> http://www.jsoftware.com/forums.htm > > >> > > > ------------------------------------------------------------------ > > > -- > > > -- For information about J forums see > > > http://www.jsoftware.com/forums.htm > > > > > > ------------------------------------------------------------------ > > > -- > > > -- For information about J forums see > > > http://www.jsoftware.com/forums.htm > > > > > > ------------------------------------------------------------------ > > > -- > > > -- For information about J forums see > > > http://www.jsoftware.com/forums.htm > > > > > -------------------------------------------------------------------- > > -- For information about J forums see > > http://www.jsoftware.com/forums.htm > > > > -------------------------------------------------------------------- > > -- For information about J forums see > > http://www.jsoftware.com/forums.htm > > -------------------------------------------------------------------- > > -- For information about J forums see > > http://www.jsoftware.com/forums.htm > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
