Linda Alvord wrote: > > Challenge 6 Many Many Cherry Trees PLEASE DO NOT RESPOND UNTIL 2/22/2012 > 12 am EST > > > > > > If necessary, ask questions, but try not to give away your strategy for > solving the challenge. > > > > Design a function with no restrictions on style or specific functions. > > It should produce a triangle similar to the ones shown below. Each row is > a > successive scramble of the character string above it with one added > symbol. > The final line is a scramble of the entire list. > > > > gw 'many' > > a > a n > a y n > a m y n > > > > gw 'many' > > m > y m > y a m > n a m y > > > > gw 'cherrytrees' > > s > r s > h s r > h r s y > y s r e h > e h r s r y > y r e s h e r > s e r r e y e h > e s t e r e y h r > r e r s t r y e e h > e r c r h y r e t s e > > a=:gw '%%%####' > > a,.a,.a,.a > > % % % % > % # % # % # % # > % # % % # % % # % % # % > % # # % % # # % % # # % % # # % > # % # % # # % # % # # % # % # # % # % # > # % # % % # # % # % % # # % # % % # # % # % % # > # % # # # % % # % # # # % % # % # # # % % # % # # # % % > > > > Linda > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > > My take on this problem:
p =. {~ ?~@# gw =: (1-#)\. (|. 1j1&#)"_1 p\@p Or, inlined: gw =: (1-#)\. (|. 1j1&#)"_1 ({~ ?~@#)\@({~ ?~@#) which turns out to be just like Dan's solution. a=.gw '##&&**! ' a,.a,.a * * * * * * # * # * # * & * # & * # & * # # & * # # & * # # & * # & * ! # # & * ! # # & * ! # # * ! * # & # * ! * # & # * ! * # & # # # ! * & & * # # ! * & & * # # ! * & & * (gw,.gw,.gw)'|-/+\**' / * * / + * \ / * \ / + \ - * * + / \ + - / - * / \ * / - + + | \ / - - * \ | / + - | * / - | / \ * + \ * + / | - \ / + | - * - + | * / \ * \ * | + / * - / | - \ * * + -- View this message in context: http://old.nabble.com/Challenge-6-Many-Many-Cherry-Trees-tp33320767s24193p33391211.html Sent from the J Programming mailing list archive at Nabble.com. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm