Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/iter/lib/reducers.ts>norm

A bunch of utilities for working with iterables, many inspired by the native array methods.
Latest
function norm
import { norm } from "https://deno.land/x/iter@v3.2.3/lib/reducers.ts";
Finds the norm of it (distance from the origin).

warning: When ran on an endless iterable, this never returns.

Examples

Example 1

import * as iter from "https://deno.land/x/iter";

const pythagoreadQuad = [12, 16, 21];
console.log(iter.norm(pythagoreadQuad)); // -> 29

Parameters

it: Iterable<number>
  • The iterable to sum.

Returns

number

The norm of it.