Actually I didn't use [: in the explicit definition. J did it(always place blame elsewhere). This is read as "a reflexive grade up of a nub stitched to a tally of a reflexive key of a list'. fd=: 13 :'/:~(~.y),.#/.~y' fd [: /:~ ~. ,. #/.~
To understand it you must first unlock the key. I am a user of J so I start with: f=: 13 :'({.;}.)":y,x+/y' g=: 13 :'('' ''&;),.x' I try to communicate with programmers, so I check up on them. f [: ({. ; }.) [: ": ] , +/ g [: ' '&; [: ,. [ Here is how Ken presented the same verbs which were in the first challenge: over=:({. ; }.)@":@, by=:' '&;@,.@[ ,. ] Probably many programmers read this easily and are very happy. However, look at the trees. 5!:4 <'by' -- ' ' -- & -+- ; -- @ -+- ,. -- @ -+- [ --+- ,. L- ] 5!:4 <'f' -- [: │ -- {. +----+- ; │ L- }. --+ │ -- [: │ +- ": L----+ -- ] L----+- , L- / --- + Maybe I like the second tree better because I am left handed. I apply the verbs from right to left. I'm not sure this helps. I am very slow at untangling the programmers version and think as a user. Linda -----Original Message----- From: programming-boun...@jsoftware.com [mailto:programming-boun...@jsoftware.com] On Behalf Of Mike Day Sent: Sunday, January 15, 2012 7:11 AM To: Programming forum Subject: Re: [Jprogramming] Challenge 4 Bountiful Birthdays Linda, why do you eschew @ (and also, presumably @: ) but allow [: ? You've probably been asked before.... MIke On 15/01/2012 10:40 AM, Linda Alvord wrote: > I have been reluctant to include the interesting fd created by Henry Rich > and Ric Sherlock because I was unable to write the explicit version that > produces their tacit version. I finally got it , so we now have another fd. > > > > fdrs=:[: /:~ ({. , #)/.~ > > fdrs > > [: /:~ ({. , #)/.~ > > > > > > a=:3 2 3 3 1 3 4 1 1 2 > > fd=: 13 :'/:~(~.y),.#/.~y' > > fd > > [: /:~ ~. ,. #/.~ > > fd a > > 1 3 > 2 2 > 3 4 > 4 1 > > > > From: Linda Alvord [mailto:lindaalv...@verizon.net] > Sent: Monday, January 09, 2012 10:45 AM > To: 'Linda Alvord' > Subject: Challenge 4 Bountiful Birthdays > > > > Chalenge 4 Bountiful Birthdays PLEASE DO NOT RESPOND UNTIL 1/16/2012 > 12 am EST > > > > For this challenge, as usual, do not use @ but you may use whatever style > and strategy you like to accomplish the task. > > > > The problem is to simulate the classic birthday problem. > > > > A single trial works this way. People enter a room one by one and declare > their birth date. Suppose the 29th person is the first person to match a > birthday of someone in the room. The result of the first trial is 29. > > > > Repeat for 500 trials. > > > > If you use Kip's frequency distribution of the results you have lots of > information. > > > > fd=:[: /:~ ~. ,. [: +/"1 ~. =/ ] > > > > But the mean gives a more concise summary of the data. So, the final part > of the problem is to obtain a list of 10 means of 500 trials and the > mean of the means. > > > > 'til next week. > > > > Linda > > ---------------------------------------------------------------------- > 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