My solution was

foo=: 4 : 0
'x0 x1'=. x
z=. (<"0 x0) ,. (x1 # i.#x1)</.y
(<@]^:[&>/)"1 z
)

It contains parts of both your and Hui's solution.
Thanks.


R.E. Boss


> -----Oorspronkelijk bericht-----
> Van: [email protected] [mailto:programming-
> [email protected]] Namens Raul Miller
> Verzonden: woensdag 3 juni 2009 21:42
> Aan: Programming forum
> Onderwerp: Re: [Jprogramming] leveled as indicated
> 
> foo=:4 :0
>   assert. 4 = (3!:0) x         NB. x is integer
>   assert. 2 = # x              NB. x has 2 items
>   assert. 2 = #$ x     NB. x has rank 2
>   assert. (# y) = +/{: x
>   assert. 0 < <./{. x          NB. {.x is positive
>   'd l'=.x
>   d <@]^:[&> (; l {.&.> 1) <;.1 y
> )
> ----------------------------------------------------------------------
> 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