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