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
[
"Friday",
"Thursday",
"Wednesday",
"Tuesday",
"Monday"
]
# Normal output (without mtac)
» ja [Monday..Friday]
[
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"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).
mtac
list.reverse
prefix
): Prefix a string to every item in a listsuffix
): Prefix a string to every item in a listappend
): Add data to the end of an arraycount
): Count items in a map, list or array2darray
): Create a 2D JSON array from multiple input sourcesja
): A sophisticated yet simply way to build a JSON arraymap
): Creates a map from two data sourcesta
): A sophisticated yet simple way to build an array of a user defined data-typeprepend
): Add data to the start of an arraymsort
): Sorts an array - data type agnosticjsplit
): Splits stdin into a JSON array based on a regex parametera
): A sophisticated yet simple way to stream an array or list (mkarray)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 Wed Sep 18 21:18:57 UTC 2024 against commit c037883c03788357164e9846c84d9f777251495d9452a8e.
Current version is 6.3.4225 (develop) which has been verified against tests cases.