Documentation

# `misc`::`breakmap`

Stops the mapping currently done by maprec

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

```misc::breakmap()
```

## Description

`misc::breakmap`() stops the recursive application of a function to all subexpressions of an expression that `misc::maprec` is just working on.

`misc::breakmap` is useful as a command inside the procedure mapped by `misc::maprec` in case we know that we are finished with our work and the remaining recursive mapping is not necessary.

## Examples

### Example 1

We want to know whether a given expression contains a particular type `t`. As soon as we have found the first occurrence of `t`, we can terminate our search.

```myfound := FALSE: misc::maprec(hold(((23+5.0)/3+4*I)*PI), {DOM_COMPLEX}=proc() begin myfound := misc::breakmap(); args() end_proc): myfound```
` `

What did we do? We told `misc::maprec` just to go down the expression tree and look for subexpressions of type `DOM_COMPLEX`; and, whenever such subexpression should be found, to apply a certain procedure to it. That procedure stops the recursive mapping, remembers that we have found the type we had searched for, and returns exactly its argument such that the result returned by `misc::maprec` equals the input. In the example below, we test whether our given expression contains the type `DOM_POLY`.

```myfound := FALSE: misc::maprec(hold(((23+5.0)/3+4*I)*PI), {DOM_POLY}=proc() begin myfound := misc::breakmap(); args() end_proc): myfound```
` `

Note that you do not need to use this method when searching for subexpressions of a given type; calling `hastype` is certainly more convenient.

## Return Values

`misc::breakmap` always returns `TRUE`.