>>
<<
Ndx
Usr
Pri
JfC
LJ
Phr
Dic
Rel
Voc
!:
wd
Help
Dictionary
assert.
assert. T
An assertion failure is signalled if the single sentence T
is not an array of all 1s. Assertions are evaluated or not according
to the flag controlled by 9!:34
and 9!:35 .
|
For example:
cfi=: 4 : 0 " 0 The y-th combination of i.x
assert. 0<:y
assert. y=<.y
assert. y<2^x
v=. +/\(i.x)!x
m=. (y<v)i. 1
(m,x) ci (y-m{0,v)
)
ci=: 4 : 0 " 1 0
'm n'=. x
if. 0=m do.
i.0
else.
v=. +/\ (m-1)!(1-m)}.i.-n
k=. (v>y) i. 1
k,(1+k)+(x-1,1+k)ci(y-k{0,v)
end.
)
5 cfi 6
0 1
5 cfi 6+i.10
0 1
0 2
0 3
0 4
1 2
1 3
1 4
2 3
2 4
3 4
(i.100) -: 100x cfi <:2^100x
1
5 cfi 33
|assertion failure: cfi
| y<2^x
5 cfi 6.2
|assertion failure: cfi
| y=<.y
5 cfi 'a'
|domain error: cfi
| y= <.y
>>
<<
Ndx
Usr
Pri
JfC
LJ
Phr
Dic
Rel
Voc
!:
wd
Help
Dictionary