---
title: "Retrieve"
canonical: "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/Coproducts/retrieve.html"
source: "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/Coproducts/retrieve.md"
part: "Sets, Sequences, and Mappings"
chapter: "Coproducts"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Sets, Sequences, and Mappings", "source": "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/index-sets-sequences-mappings.md"}
  - {"title": "Coproducts", "source": "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/Coproducts/index-coproducts.md"}
prev: {"title": "Accessing Functions", "source": "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/Coproducts/access.md"}
next: {"title": "Flattening", "source": "https://docs.magma-maths.org/v2.30-1/SetsSequencesMappings/Coproducts/flat.md"}
intrinsics:
  - {"name": "Retrieve", "signature": "Retrieve(x): CopElt -> Elt"}
examples:
  - "ex-13536c"
---

# Retrieve

The function described here restores an element of a coproduct to its original state.

<a id="function-retrieve-copelt"></a>
## `Retrieve(x): CopElt -> Elt`

Given an element $x$ of some coproduct $C$, return the element as an element of the structure that formed its parent before it was mapped into $C$.

<a id="example-ex-13536c"></a>
## `Example: Basic Use of Coproducts (ex-13536c)`

We illustrate basic uses of the coproduct constructors and functions.

```magma
> C := cop<IntegerRing(), Strings()>;
> x := C ! 5;
> y := C ! "abc";
> x;
5
> y;
abc
> Parent(x);
Coproduct<Integer Ring, String structure>
> x eq 5;
true
> x eq y;
false
> Retrieve(x);
5
> Parent(Retrieve(x));
Integer Ring
```
