Anonymous user
Burrows–Wheeler transform: Difference between revisions
m
→{{header|REXX}}: simplified the code, eliminated the use of a subroutine.
m (→{{header|REXX}}: simplified the code, eliminated the use of a subroutine.) |
|||
Line 741:
$.7= "bad─bad thingy"'fd'x /* ◄─── this string can't be processed.*/
end
do t=1 while $.t\=''; if t\==1 then
▲ if t\==1 then say /*insert a blank line between outputs. */
out= BWT($.t) /*invoke the BWT function, get result*/
ori= iBWT(out) /* " " iBWT " " " */
Line 754 ⟶ 753:
BWT: procedure expose ?.; parse arg y,,$ /*obtain the input; nullify $ string. */
?.1= 'fd'x; ?.2= "fc"x /*assign the STX and ETX strings. */
if loc\==0 then call BWTer /*there an " " " " ? */▼
y= ?.1 || y || ?.2 /*obtain the input; add a fence to it.*/
L= length(y); m= L-1 /*get the length of new text; get L-1.*/
Line 769:
end /*k*/ /* ··· the array's right─most character*/
return $ /*return the constructed answer. */
▲BWTer: er= '***error*** BWT: '; say er "invalid input: " y
▲ say er 'The input string contains an invalid character at position' loc"."; exit 13
/*──────────────────────────────────────────────────────────────────────────────────────*/
iBWT: procedure expose ?.; parse arg y,,@. /*obtain the input; nullify @. string.*/
|