aboutsummaryrefslogtreecommitdiff
path: root/challenge-269/asherbhs/j/ch-2.ijs
blob: 775341a468c57e9c8477f59d88b732bdaebe1202 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
DistributeElements=.{{
	F=.{{
		NB. couldn't get structural under to work :(
		a=.>y
		i=.<:/{:@>a
		<a i}~<(>x),~>i{a
	}}
	,&>/>F/(<"0|.2}.y),<<"0]2{.y
}}

echo DistributeElements 2 1 3 4 5
echo DistributeElements 3 2 4
echo DistributeElements 5 4 3 8

exit ''