npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lolo

v1.1.2

Published

(beta) algebra & functional programming

Downloads

12

Readme

__

Basic functional tools in the __ file.

let __ = require('./src/__');

let f = x => x**2;


//====== pipes ======

let b = __.pipe(f, f, f)(3);
//  b = 6'561

let square = g => __.pipe(g, g);
    F = __.pipe(square, square);

let c = F(f)(3);
//  c = 43'046'721


//====== map ======

let xs = __.range(6);
//  xs = [0, 1, 2, 3, 4, 5]

let ys = __.map(f)(xs);
//  ys = [0, 1, 4, 9, 16, 25]


//====== application ======

let $x = __.$(5),
    y = $x(f);
//  y = 25

let apply = fs => x => __.map(__.$(x))(fs);

let iter = __.pipe(
    __.range, 
    __.map(_ => f),
    fs => __.pipe(...fs)
);
    
let fs = __.range(5).map(iter);
    ys = apply(fs)(3);
//  ys = [3, 9, 81, 6'561, 43'046'721, 1'853'020'188'851'841]

:rocket:

Record

A record type instance exposes methods such as map, filter, reduce, forEach... dedicated to js objects.

let Record = require('./record'),
    record = Record();

let r = record.compute((_, i) => i)(['x', 'y', 'z']);
//  r = {x: 0, y: 1, z: 2}

r = record.map(i => i + 1)(r);
//  r = {x: 1, y: 2, z: 3}

let sum = record.reduce((a, b) => a + b, 0),
    prod = record.reduce((a, b) => a * b, 1);

r = record.update({t: sum})(r);
//  r = {x: 1, y: 2, z: 3, t: 6}

//====== compare: ======

let r1 = record.update({p: prod, q: prod})(r),
    r2 = record.update({p: prod}, {q: prod})(r);

[r1, r2] = __.map(record.get('p', 'q'))([r1, r2]);
//  r1 = {p: 36, q: 36}
//  r2 = {p: 36, q: 1296} 

ND Arrays

An nd-array type instance exposes methods such as map, reduce, etc. dedicated to n-dimensional arrays.


let ND = require('./nd_array'),
    nd = ND();

let f_ij = ([xi, xj]) => xi * xj; 

let a = nd.compute([[1, 2, 3], [4, 5]])(f_ij);
//  a = [[4, 8, 12],
//       [5, 10, 15]] 

let sum = nd.reduce((x, y) => x + y),
    mean = a => sum(a) / nd.size(a);

m = mean(a);
//  m = 9

let b = nd.map(y => y - m)(a);
//  b = [[-5, -1, 3],
//       [-4, 1, 6]] 

let c = nd.map2((x, y) => x * y)(a, b);
//  c = [[-20, -8, 36],
//       [-20, 10, 90]];

Tensors

Real and complex algebra of nd-arrays, i.e. inherit from an nd-array type instance but provide with additional methods such as add, mult, scale, int, inner ...

Fast fourier transform implemented in fourier