mapslots/3—format a series of expressions that refer to objects into a string
The mapslots/3 function formats a series of expressions that refer to objects into a string. The syntax for this function is as follows:
mapslots/3 arguments
Argument | Mode | Type | Description |
---|---|---|---|
$OBJECTS | Input | LIST_OF OBJECT | Specifies the list of event or data objects |
$EXPRS | Input | LIST_OF STRING | Specifies the format and expressions to be evaluated |
$STR | Output | STRING | Resulting string |
Use the mapslots/3 to evaluate a list of expressions $EXPRS, referring to objects from $OBJECTS, and to format them into string $STR by using the first expression as format.
The format specification for mapslots/3 is the same as for the C language sprintf() function.
The first element from the list $EXPRS is taken as format. The rest of the expressions given in $EXPRS are compiled and evaluated at the moment the primitive is called, for each call again. Within these expressions, the objects from $OBJECTS can be referenced as $1, $2,... for the first, second,... element of the object list.
mapslots/3 example
['Event %s is associated to data %s','$1.mc_ueid','$2.mc_udid']);
A message is produced stating that an event and data object are associated. The event and data object are passed as $E and $D, respectively, in the first argument. The list of expressions contains the format for the message, followed by two expressions that result in a string. The first one retrieves the mc_ueid slot of the event object, the second one retrieves the mc_udid of the data object.