>>  <<  Ndx  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  wd  Help  User

# parts: partition functions

Partitions are typically given by a boolean with 1's marking the beginning or end of each partition. Partitions are also sometimes given in terms of the lengths of each partition.

Verbs defined here assume that boolean 1's mark the beginning of each partition - see comments at the end for examples of end-partition verbs.

The verbs psum and psumscan illustrate definitions appropriate for verbs that return scalar or non-scalar results, respectively. utility used to build non-scalar partition functions:

Examples:

```  1 0 0 1 0 0 0 = firstones 1 1 0 1 1 1 0
0 0 1 0 1 = lastones 1 1 1 0 1
2 3 1 = lfp 1 0 1 0 0 1
1 1 0 1 0 0 1 = partition 1 9 9 4 4 4 9
0 0 0 1 2 2 3 = runindices 3 1 2 1
1 2 3 1 = runlengths 1 9 9 4 4 4 9
```
```  x=. 1 0 1 0 0 [ y=. 5 3 2 2 7
```
```  3 5 7 2 2 = x preverse y
3 5 2 2 7 = x psort y
8 11 = x psum y
5 8 2 4 11 = x psumscan y
```

 Name Type Description firstones verb first 1's in partition lastones verb last 1's in partition lfp verb lengths from partition partition verb partition items (1 marks new item) pfl verb partition from lengths preverse verb partioned reverse psort verb partioned sort psum verb partioned sum psumscan verb partioned sumscan runindices verb indices from run lengths runlengths verb lengths of each run

```first 1's in partition
form: firstones part```
```last 1's in partition
form: lastones part```
```lengths from partition
form: lfp part```
```partition items (1 marks new item)
form: partition dat
partition=: 1: , }. ~: }:```
```partition from lengths
form: pfl len```
```partioned reverse
form: part preverse dat```
```partioned sort
form: part psort dat```
```partioned sum
form: part psum dat```
```partioned sumscan
form: part psumscan dat```
```indices from run lengths
form: runindices```
```lengths of each run
form: runlengths dat```

>>  <<  Ndx  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  wd  Help  User