Macaulay2 » Documentation
Packages » ForeignFunctions » ForeignType » ForeignArrayType » foreignArrayType
next | previous | forward | backward | up | index | toc

# foreignArrayType -- construct a foreign array type

- Usage:
    `foreignArrayType(name, T, n)`
    `foreignArrayType(T, n)`
    `n * T`
- Inputs:
  - name, a string,
  - T, a foreign type,
  - n, an integer,
- Outputs:
  - a foreign array type,

## Description

To construct a foreign array type, specify a name, the type of the elements of each array, and the number of elements in each array.

    i1 : foreignArrayType("myArrayType", int, 5)

    o1 = myArrayType

    o1 : ForeignArrayType

If the name is omitted, then a default one is chosen by taking the name of the type of the elements and appending the number of elements enclosed in brackets.

    i2 : foreignArrayType(int, 5)

    o2 = int32[5]

    o2 : ForeignArrayType

Alternatively, you may "multiply" the number of elements by the type to accomplish the same.

    i3 : 5 * int

    o3 = int32[5]

    o3 : ForeignArrayType

## Ways to use foreignArrayType:

- `foreignArrayType(ForeignType,ZZ)`
- `foreignArrayType(String,ForeignType,ZZ)`

## For the programmer

The object foreignArrayType is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/ForeignFunctions.m2:1240:0.