Here is how I would now do it, borrowing sh and the idea of using |. from you, Linda.
sh =: ] {~ # ? # gwk =: ([: |. [: - [: i. #) |."0 1 [: ([ , ' ' , ])/"1 [: sh\ sh gwk 'abcde' b d b e d b e a b d b e d c a Kip On 2/27/2012 4:35 AM, Linda Alvord wrote: > Here is my latest version which has simple tacit definitions. I was > impressed with all the different strategies that were submitted and it > should provide you with many options to consider and hopefully allow you to > understand J better. I know I learned a lot and I still have many more > versions to study. > > f=: 13 :'((#y)?#y){y' > f > ] {~ # ? # > f 'abcde' > deacb > > g=: 13 :'|. f \. f y' > g > [: |. [: f\. f > g 'abcde' > c > ac > dca > eadc > eacdb > > h=: 13 :'|.,"2 |:'' '',:|:|. g y' > h > [: |. [: ,"2 [: |: ' ' ,: [: |: [: |. g > h 'abcde' > a > e a > e a d > d b a e > a c e d b > > gw=: 13 :'(,.(1+#y)+i.#y)|."1 h y' > gw > ([: ,. (1 + #) + [: i. #) |."1 h > gw 'cherrytrees' > e > c e > c e r > e c h r > r y h c e > y h t r c e > r t r c e y h > y c r h t s e r > r h e y t r c e s > c r t e h s r r y e > t s e e y r r h e r c > > All the tacit expressions are quite simple looking. If I misses some of your > good ideas please let me know. Maybe I can get rid of some of the > parentheses in the final verb. I anticipate having some questions about some > of the strategies you've used when I look at them more carefully. > > Linda > > > -----Original Message----- > From: programming-boun...@jsoftware.com > [mailto:programming-boun...@jsoftware.com] On Behalf Of Linda Alvord > Sent: Sunday, February 26, 2012 3:33 PM > To: 'Programming forum' > Subject: Re: [Jprogramming] Challenge 6 Many Many Cherry Trees > > I noticed that all the first group begin with c but I didn't notice that > all the last group end with d > > I don't often find my own problems. > > Linda > > -----Original Message----- > From: programming-boun...@jsoftware.com > [mailto:programming-boun...@jsoftware.com] On Behalf Of Linda Alvord > Sent: Sunday, February 26, 2012 6:10 AM > To: 'Programming forum' > Subject: Re: [Jprogramming] Challenge 6 Many Many Cherry Trees > > Here's more I don't understand. > > p=: 13 :'((#y)?#y){y' > p\p 'abcde' > e > eb > bea > bdea > baedc > > Why is this a domain error? > > (((#y)?#y){y)\((#y)?#y){y=:'abcde' > |domain error > | (((#y)?#y){y)\((#y)?#y){y=:'abcde' > > Why is each row not scrambled in the first example but they are in the > second? > > ]\ 'cbaed' > c > cb > cba > cbae > cbaed > > ]\. 'cbaed' > cbaed > baed > aed > ed > d > > > > -----Original Message----- > From: programming-boun...@jsoftware.com > [mailto:programming-boun...@jsoftware.com] On Behalf Of Raul Miller > Sent: Friday, February 24, 2012 11:57 AM > To: Programming forum > Subject: Re: [Jprogramming] Challenge 6 Many Many Cherry Trees > > On Fri, Feb 24, 2012 at 11:39 AM, Kip Murray<k...@math.uh.edu> wrote: >> Raul has explained "0 _ . In effect I was re-inventing<\. (box suffix) . > > Or, more specifically: > ]\. 'cbaed' > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm