P.S. The Vocabulary discusses the rank conjunction " under four cases noun"noun verb"noun noun"verb and verb"verb .
For now all you need to know about noun"noun is that (i. 2 3)"_ is a "constant verb" which always returns i. 2 3, and all you need to know about verb"noun is contained in Section 20. Rank where it is called f"k . Ignore the other cases for now. On 12/4/2011 3:42 PM, Kip Murray wrote: > I am glad you are exploring rank, which is fundamental to understanding J. > > The Dictionary's Introduction Section 20. Rank has good examples for you > to work through. Find it here: > > http://www.jsoftware.com/docs/help701/dictionary/contents.htm > > On 12/4/2011 12:00 PM, Linda Alvord wrote: >> I have finally been gritting my teeth and facing rank. >> >> toss =: (dice =: (6 6 6#:12 145 157 185 197 215)<@:{"1 2 (#:i.6){' o'){~ 2 >> 10 ?@$ 6: >> a=:6 3$0 2 0 4 0 1 4 2 1 5 0 5 5 2 5 5 5 5 >> 6 6 6#.a >> g=:' o' >> b=:#:i.6 >> d=:b{g >> dice=:<"2 a{"1 2 d >> dice >> s=:[:?(2 10$6)"_ >> c=:s'' >> s >> c >> >> dice{~c=:s'' >> 1+c >> dice{~c=:s'' >> 1+c >> toss2=: 13 :'dice{~y' >> toss2 s'' >> 1+c >> toss2 s'' >> 1+c >> 5!:2 ;:'toss a g b d dice cc c toss2' >> >> I'm not quite keeping up too well, but this is interesting. >> >> Linda >> >> >> -----Original Message----- >> From: programming-boun...@jsoftware.com >> [mailto:programming-boun...@jsoftware.com] On Behalf Of Kip Murray >> Sent: Thursday, December 01, 2011 9:46 AM >> To: Programming forum >> Subject: Re: [Jprogramming] Turkey Roll - Challenge 2 Rich Text >> >> Not precisely what you asked for, Linda, but equivalent: >> >> one =: ' ',' o ',:' ' >> two =: 'o ',' ',:' o' >> three =: 'o ',' o ',:' o' >> four =: 'o o',' ',:'o o' >> five =: 'o o',' o ',:'o o' >> six =: 'o o','o o',:'o o' >> >> ]dice =: one;two;three;four;five;six >> +---+---+---+---+---+---+ >> | |o |o |o o|o o|o o| >> | o | | o | | o |o o| >> | | o| o|o o|o o|o o| >> +---+---+---+---+---+---+ >> >> ten =: [: ? (2 10 $ 6)"_ NB. ten tosses of two dice >> >> ]toss =: ten'' >> 5 4 5 2 4 3 0 2 4 2 >> 2 1 4 4 3 2 0 3 3 3 >> >> toss { dice >> +---+---+---+---+---+---+---+---+---+---+ >> |o o|o o|o o|o |o o|o o| |o |o o|o | >> |o o| o |o o| o | o | | o | o | o | o | >> |o o|o o|o o| o|o o|o o| | o|o o| o| >> +---+---+---+---+---+---+---+---+---+---+ >> |o |o |o o|o o|o o|o | |o o|o o|o o| >> | o | | o | o | | o | o | | | | >> | o| o|o o|o o|o o| o| |o o|o o|o o| >> +---+---+---+---+---+---+---+---+---+---+ >> >> ]sums =: 2 + +/ toss >> 9 7 11 8 9 7 2 7 9 7 >> >> fd =: [: /:~ ~. ,. [: +/"1 ~. =/ ] >> >> fd sums >> 2 1 >> 7 4 >> 8 1 >> 9 3 >> 11 1 >> >> 4!:0 'dice';'toss';'sums';'fd' >> 0 0 0 3 >> >> >> On 11/26/2011 3:14 AM, Linda Alvord wrote: >>> Version 3 Rich Text >>> >>> Version 2 Plain text. How can I make the graphic symbols look good? >>> >>> PLEASE DO NOT REPLY BEFORE December I, 2011 at 12:00 am EST ! >>> >>> The turkey roll challenge, named in honor of the Thanksgiving Day >>> holiday, focuses on the verb roll or ? with one argument. >>> >>> Create two nouns and a verb that will generate the following results. >>> >>> dice >>> ----T---T---T---T---T---┐ >>> │ │o │o │o o│o o│o o│ >>> │ o │ │ o │ │ o │o o│ >>> │ │ o│ o│o o│o o│o o│ >>> L---+---+---+---+---+---- >>> >>> toss >>> ----T-T---T-T---T-T---T-T---T-T---T-T---T-T---T-T---T-T---┐ >>> │o │ │o │ │o o│ │o o│ │o │ │o │ │ │ │o o│ │o │ │o │ >>> │ o │ │ │ │ │ │ o │ │ o │ │ │ │ o │ │ │ │ o │ │ │ >>> │ o│ │ o│ │o o│ │o o│ │ o│ │ o│ │ │ │o o│ │ o│ │ o│ >>> +---+-+---+-+---+-+---+-+---+-+---+-+---+-+---+-+---+-+---+ >>> │o │ │o │ │o │ │o │ │o o│ │ │ │ │ │o o│ │o o│ │ │ >>> │ │ │ o │ │ │ │ │ │ o │ │ o │ │ o │ │ │ │o o│ │ o │ >>> │ o│ │ o│ │ o│ │ o│ │o o│ │ │ │ │ │o o│ │o o│ │ │ >>> L---+-+---+-+---+-+---+-+---+-+---+-+---+-+---+-+---+-+---- >>> toss >>> ----T-T---T-T---T-T---T-T---T-T---T-T---T-T---T-T---T-T---┐ >>> │o │ │o │ │o o│ │o o│ │o │ │o │ │ │ │o o│ │o │ │o │ >>> │ o │ │ │ │ │ │ o │ │ o │ │ │ │ o │ │ │ │ o │ │ │ >>> │ o│ │ o│ │o o│ │o o│ │ o│ │ o│ │ │ │o o│ │ o│ │ o│ >>> +---+-+---+-+---+-+---+-+---+-+---+-+---+-+---+-+---+-+---+ >>> │o │ │o │ │o │ │o │ │o o│ │ │ │ │ │o o│ │o o│ │ │ >>> │ │ │ o │ │ │ │ │ │ o │ │ o │ │ o │ │ │ │o o│ │ o │ >>> │ o│ │ o│ │ o│ │ o│ │o o│ │ │ │ │ │o o│ │o o│ │ │ >>> L---+-+---+-+---+-+---+-+---+-+---+-+---+-+---+-+---+-+---- >>> >>> c=:3 8 7 12 9 8 9 7 4 12 NB. The list c is the sums of the >>> NB. second toss of ten dice >>> fd c >>> 3 1 NB. A frequency distribution of the >>> 4 1 NB. ten tosses >>> 7 2 >>> 8 2 >>> 9 2 >>> 12 2 >>> >>> 4!:0 'dice';'toss';'c';'fd' >>> 0 0 0 3 NB. 0 for nouns, 3 for verbs >>> >>> >>> Some rules and hints: >>> >>> Write all verbs and nouns without @ . You can use several nouns >>> and >>> verbs to make a final noun or verb. Here are some things about roll. >>> >>> r=: 13 :'?y' >>> r >>> ? >>> r 4 >>> 3 >>> r 4 >>> 2 >>> s=: 13 :'r 3 4$y' >>> s >>> [: r 3 4 $ ] >>> s 5 >>> 3 3 3 2 >>> 3 2 3 4 >>> 2 4 0 4 >>> s 5 >>> 1 3 1 0 >>> 3 1 4 1 >>> 4 2 1 3 >>> t=: 13 :'(r s y)*3 4$100*i.4' >>> 5 t 5 >>> 1003 1000.69 1000.5 1001.49 >>> 1001 1000.55 1000 1001 >>> 1000.89 1001.03 1002 1000 >>> 5 t 5 >>> 1001 1002 1000 1001.37 >>> 1003 1000.04 1000.23 1002 >>> 1000.01 1001 1000.3 1001.16 >>> >>> Be sure to get unique results as you go. Notice how to build a complex >>> result with several shorter functions. >>> >>> Linda >>> >>> ---------------------------------------------------------------------- >>> For information about >>> ---------------------------------------------------------------------- >>> 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