math.transforms.bwt: Simplify two places in bwt.

db4
Doug Coleman 2012-09-10 08:52:42 -07:00
parent 9fe9437445
commit 3014b1828a
1 changed files with 2 additions and 2 deletions
extra/math/transforms/bwt

View File

@ -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 ;