murex Shell Docs

Command Reference: mtac

Reverse the order of an array

Description

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.

Usage

<stdin> -> mtac -> <stdout>

Examples

» ja: [Monday..Friday] -> mtac
[
    "Friday",
    "Thursday",
    "Wednesday",
    "Tuesday",
    "Monday"
]

# Normal output (without mtac)
» ja: [Monday..Friday]
[
    "Monday",
    "Tuesday",
    "Wednesday",
    "Thursday",
    "Friday"
]

Detail

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 is rebuilt weekly, the content is automatically generated from murex's source code. Last built on Mon May 25 06:11:51 UTC 2020 against commit aa3f3b7aa3f3b7e471543754fdcaf910d4920cad9112b91. Downloadable murex binaries are also built weekly. Current version is 0.48.0120 BETA which has been verified against 29375 tests.