math.transforms.bwt: Simplify two places in bwt.
parent
9fe9437445
commit
3014b1828a
extra/math/transforms/bwt
|
@ -7,9 +7,9 @@ IN: math.transforms.bwt
|
|||
! Inefficient versions of Burrows-Wheeler Transform
|
||||
|
||||
: bwt ( seq -- newseq )
|
||||
{ 0 } swap append all-rotations natural-sort [ last ] map ;
|
||||
0 suffix all-rotations natural-sort [ last ] map ;
|
||||
|
||||
: ibwt ( newseq -- seq )
|
||||
[ length [ { } <array> ] keep ] keep
|
||||
'[ _ [ prefix ] 2map natural-sort ] times
|
||||
[ { 0 } tail? ] find nip 1 head* ;
|
||||
[ { 0 } tail? ] find nip but-last ;
|
||||
|
|
Loading…
Reference in New Issue