Array Reverse: 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).

Synonyms

See Also


This document was generated from builtins/core/lists/mtac_doc.yaml.

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 Oct 12 23:53:07 UTC 2026 against commit 6332fa16332fa1e89d3a5df5c6104d7f19d017367bb74f9.

Current version is 7.3.1232 (unknown) which has been verified against tests cases.