Burrows–Wheeler transform: Difference between revisions

Content added Content deleted
Line 1,033: Line 1,033:
else $x.stx + . + $x.etx
else $x.stx + . + $x.etx
| . as $s
| . as $s
| (reduce range(0; length) as $i ([]; .[$i] = $s[$i:] + $s[:$i]) | sort) as $table
| (reduce range(0; length) as $i ([];
| reduce range(0; length) as $i (""; . + $table[$i][-1:])
.[$i] = $s[$i:] + $s[:$i]) | sort) as $table
| reduce range(0; length) as $i ("";
. + $table[$i][-1:])
end;
end;


Line 1,059: Line 1,061:
| . as $test
| . as $test
| bwt as $t
| bwt as $t
| "\(makePrintable)\n --> \($t | makePrintable // "ERROR: String can't contain STX or ETX" )"
| "\(makePrintable)\n --> \($t | makePrintable
// "ERROR: String can't contain STX or ETX" )",
,
(if $t then " --> \($t | ibwt)\n" else "" end) ;
(if $t then " --> \($t | ibwt)\n" else "" end) ;


tests</lang>
tests</lang>
Line 1,089: Line 1,091:
--> ERROR: String can't contain STX or ETX
--> ERROR: String can't contain STX or ETX
</pre>
</pre>



=={{header|Julia}}==
=={{header|Julia}}==