It should also work with deeper trees.

One way that avoids the tree building step is

,&.:(<"1)@:((] ,"0 1 $:^:(1 < #)@-.)"1 0~)  0 1 2 3

but I also struggle with the tree walking approach that is say generated with

(] <@; $:^:(1 < #)@-.)"1 0~ 0 1 2 3



----- Original Message -----
From: Raul Miller <rauldmil...@gmail.com>
To: Programming forum <programm...@jsoftware.com>
Sent: Monday, May 2, 2016 1:06 PM
Subject: Re: [Jprogramming] permutations the slow way

This good enough?

   ;"1 ({.,.>@}.)S:2 (] <@; $:^:(1 < #)@-.)"1 0~ 0 1 2

Or did you have additional constraints?

Thanks,

-- 
Raul


On Mon, May 2, 2016 at 11:21 AM, 'Pascal Jasmin' via Programming
<programm...@jsoftware.com> wrote:
> how might you derive the unboxed permutation list from this tree?
>
> (] <@; $:^:(1 < #)@-.)"1 0~  0 1 2
> +---------------+---------------+---------------+
> |+-+-----+-----+|+-+-----+-----+|+-+-----+-----+|
> ||0|+-+-+|+-+-+|||1|+-+-+|+-+-+|||2|+-+-+|+-+-+||
> || ||1|2|||2|1|||| ||0|2|||2|0|||| ||0|1|||1|0|||
> || |+-+-+|+-+-+||| |+-+-+|+-+-+||| |+-+-+|+-+-+||
> |+-+-----+-----+|+-+-----+-----+|+-+-----+-----+|
> +---------------+---------------+---------------+
> ----------------------------------------------------------------------
> 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