Expression Broadcasting
===============================================================================

%% `broadcasting` allows you to apply operations element-wise over data structures such as matrices.

1. Introduction
-------------------------------------------------------------------------------

In Mech, broadcasting enables you to perform operations on data structures of different shapes and sizes without the need for explicit loops. Broadcasting rules are straightforward:

1. If both operands are of the same shape, perform the operation element-wise.
2. If one operand is a scalar, it is expanded to match the shape of the other operand.

If the operands have different shapes, the operation cannot occur.

For example:

```mech:ex 1
A := [ 1 2 3
       4 5 6 ]
B := [ 10 20 30
       40 50 60 ]
C := A + B
```

Or adding a scalar to a matrix:

```mech:ex 2
A := [ 1 2 3
       4 5 6 ]
B := 10
C := A + B
```

Functions also support broadcasting:

```mech:ex 3
A := [ 1 4 9
       16 25 36 ]
B := math/sqrt(A)
```