g=: 13 :'((>:i.$ y)*"2 (=/~ +. ] =/ |.) >:i.$ y){'' '',y'
   g
(([: >: [: i. $) *"2 [: (=/~ +. ] =/ |.) [: >: [: i. $) { ' ' , ]
   
  g 'good puzzle'
g         g
 o       o 
  o     o  
   d   d   
           
     p     
    u u    
   z   z   
  z     z  
 l       l 
e         e


Linda

-----Original Message-----
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Linda Alvord
Sent: Monday, December 10, 2012 1:40 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Just for fun, verb cross

   f=:(([: >: [: i. $) *"2 =/~ +. ] =/ |.) { ' ' , ]
   f 'abcdefg'
a     a
 b   b 
  c c  
   d   
  e e  
 f   f 
g     g
   q 'good puzzle'
g         g
 oo     oo 
 oo     oo 
   d   d   
           
     p     
    u u    
  zz   zz  
  zz   zz  
 l       l 
e         e
   
Linda

-----Original Message-----
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Marshall
Lochbaum
Sent: Sunday, December 09, 2012 11:07 PM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Just for fun, verb cross

Here's a pretty good version:

   cross =: {~`(],#@[->:@])`(' '"0~[)}"_ 0  i.@#
   cross 'abcde'
a   a
 b b
  c
 d d 
e   e

The important simplification here is to do it by lines and not build the
whole structure at once.

Marshall

On Sun, Dec 09, 2012 at 08:42:13PM -0600, km wrote:
> Write verb cross.
> 
>     cross 'abcde'
>  a   a
>   b b 
>    c  
>   d d 
>  e   e
>  
>  (Result should look like a cross with 'abcde' along both diagonals.)
>  
>     cross 'a'
>  a
>     cross 'ab'
>  aa
>  bb
>  
> Kip Murray
> ----------------------------------------------------------------------
> 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

Reply via email to