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: [email protected]
[mailto:[email protected]] On Behalf Of Marshall
Lochbaum
Sent: Sunday, December 09, 2012 11:07 PM
To: [email protected]
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