murex Shell Docs

Command Reference: mtac

Reverse the order of an array


mtac takes input from STDIN and reverses the order of it.

It’s name is derived from a program called tac - a tool that functions like cat but returns the contents in the reverse order. The difference with the mtac builtin is that it is data-type aware. So it doesn’t just function as a replacement for tac but it also works on JSON arrays, s-expressions, and any other data-type supporting arrays compiled into murex.


<stdin> -> mtac -> <stdout>


» ja: [Monday..Friday] -> mtac

# Normal output (without mtac)
» ja: [Monday..Friday]


Please bare in mind that while murex is optimised with concurrency and streaming in mind, it’s impossible to reverse an incomplete array. Thus all all of STDIN must have been read and that file closed before mtac can output.

In practical terms you shouldn’t notice any difference except for when STDIN is a long running process or non-standard stream (eg network pipe).


See Also

This site's content is rebuilt automatically from murex's source code after each merge to the master branch. Downloadable murex binaries are also built with the website.

Last built on Mon Feb 13 09:18:06 UTC 2023 against commit f339958f33995895c1d997efcdbb8408d2c8d45f8b5f934.

Current version is which has been verified against 13950 tests cases.