Burrows–Wheeler transform: Difference between revisions

Content added Content deleted
(→‎{{header|TXR}}: Shorter code, particularly ibwt; sanity check in bwt.)
(→‎{{header|TXR}}: Replace collect-each in bwt with mapcar.)
Line 2,670: Line 2,670:
(error "~s: input may not contain ~a" %fun% eof))
(error "~s: input may not contain ~a" %fun% eof))
(let* ((seof `@str@eof`))
(let* ((seof `@str@eof`))
(flow (collect-each ((i 0..(len seof)))
(flow 0..(len seof) (mapcar (op rot seof)) sort (mappend last))))
(rot seof i))
sort
(mappend last))))


(defun ibwt (str)
(defun ibwt (str)