Home
Getting Started
  • Fundamentals
  • Advanced
  • Fundamentals
  • Intermediate
  • Advanced
OM-Functions
  • FAQs
  • Glossary
  • Contributing
Changelog
Github
Home
Getting Started
  • Fundamentals
  • Advanced
  • Fundamentals
  • Intermediate
  • Advanced
OM-Functions
  • FAQs
  • Glossary
  • Contributing
Changelog
Github
  • OM-Functions

    • OM-Functions Overview
    • Arithmetic Operations
    • Array Operations
    • Logical Operations
    • Statistics
    • Transformations
    • Utilities

Utilities

These functions assist with array handling and display tasks:

1. mad.clone(array)

Creates a deep copy of an array:

ParameterTypeDescription
arrayArrayThe array to copy
ReturnsArrayA deep-cloned array
ReturnsArrayReshaped array

Example:

import { clone } from 'openmadness';

const newArray = clone([1, 2, 3]);
// Result: [1, 2, 3]

2. mad.print(array)

Prints the array to the console in a readable format:

ParameterTypeDescription
arrayArrayArray to display
ReturnsvoidNo return value
ReturnsArrayReshaped array

Example:

import { print } from 'openmadness';
const array = [[1, 2], [3, 4]]
print(array);
// Console: [ [1, 2], [3, 4] ]

3. mad.toArray(madArray)

Converts a mad array into a plain JavaScript array:

ParameterTypeDescription
madArrayMad ObjectInternal mad representation
ReturnsArrayPlain JavaScript array

Example:

import { toArray, zeros } from 'openmadness';

const jsArray = toArray(zeros([2, 2]));
// Result: [[0, 0], [0, 0]]
Edit this page on GitHub
Last Updated:: 7/11/25, 12:24 PM
Contributors: Dev-Liz
Prev
Transformations