New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

functionalscript

Package Overview
Dependencies
Maintainers
0
Versions
452
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

functionalscript - npm Package Compare versions

Comparing version 0.3.7 to 0.3.8

1

com/cpp/module.f.js

@@ -7,3 +7,2 @@ /**

import * as text from "../../text/module.f.js";
import * as O from "../../types/object/module.f.js";
import { map, flatMap, flat } from "../../types/list/module.f.js";

@@ -10,0 +9,0 @@ import { join } from "../../types/string/module.f.js";

11

com/cs/module.f.js

@@ -11,3 +11,2 @@ /**

import { join } from "../../types/string/module.f.js";
import * as O from "../../types/object/module.f.js";
const { entries } = Object;

@@ -35,4 +34,4 @@ const using = (v) => `using ${v};`;

const baseType = (t) => baseTypeMap[t];
const unsafe = isUnsafe => isUnsafe ? 'unsafe ' : '';
const fullType = t => typeof (t) === 'string' ?
const unsafe = (isUnsafe) => isUnsafe ? 'unsafe ' : '';
const fullType = (t) => typeof (t) === 'string' ?
[false, baseType(t)] :

@@ -42,3 +41,3 @@ t.length === 1 ?

[true, `${type(t[1])}*`];
const type = t => fullType(t)[1];
const type = (t) => fullType(t)[1];
const param = ([name, t]) => `${type(t)} ${name}`;

@@ -50,3 +49,3 @@ const mapParam = map(param);

};
const isUnsafeField = field => fullType(field[1])[0];
const isUnsafeField = (field) => fullType(field[1])[0];
const mapIsUnsafeField = map(isUnsafeField);

@@ -80,3 +79,3 @@ const resultVoid = result('void');

*/
export const cs = name => library => {
export const cs = (name) => (library) => {
const v = flatMapDef(entries(library));

@@ -83,0 +82,0 @@ const ns = namespace(name)(v);

@@ -5,6 +5,6 @@ /**

* The module provides functions to define structs, traits, and implementations in Rust,
* specifically tailored for `nanocom` interoperation.
* specifically tailored for `nanocom` interpretation.
*/
import { type Library } from '../types/module.f.ts';
import * as Text from '../../text/module.f.ts';
import type * as text from '../../text/module.f.ts';
/**

@@ -16,2 +16,2 @@ * Generates Rust code for the given type library.

*/
export declare const rust: (library: Library) => Text.Block;
export declare const rust: (library: Library) => text.Block;

@@ -5,25 +5,20 @@ /**

* The module provides functions to define structs, traits, and implementations in Rust,
* specifically tailored for `nanocom` interoperation.
* specifically tailored for `nanocom` interpretation.
*/
import { paramList } from "../types/module.f.js";
import * as Text from "../../text/module.f.js";
import * as O from "../../types/object/module.f.js";
import * as list from "../../types/list/module.f.js";
const { flat, map, flatMap } = list;
import { flat, map, flatMap } from "../../types/list/module.f.js";
import { fn } from "../../types/function/module.f.js";
import { join } from "../../types/string/module.f.js";
const { entries } = Object;
import * as func from "../../types/function/module.f.js";
const { fn } = func;
import * as string from "../../types/string/module.f.js";
const { join } = string;
const rustField = field => `pub ${field},`;
const rustField = (field) => `pub ${field},`;
const mapRustField = map(rustField);
const rustStruct = b => name => [`#[repr(C)]`, `pub struct ${name} {`, mapRustField(b), `}`];
const rustStruct = (b) => (name) => [`#[repr(C)]`, `pub struct ${name} {`, mapRustField(b), `}`];
const commaJoin = join(', ');
const ref = name => `${name}::Ref`;
const obj = name => `&${name}::Object`;
const ref = (name) => `${name}::Ref`;
const obj = (name) => `&${name}::Object`;
const self = ['&self'];
const paramName = ([n]) => n;
const callList = p => map(paramName)(paramList(p));
const call = p => commaJoin(callList(p));
const virtualCall = p => commaJoin(flat([['self'], callList(p)]));
const callList = (p) => map(paramName)(paramList(p));
const call = (p) => commaJoin(callList(p));
const virtualCall = (p) => commaJoin(flat([['self'], callList(p)]));
const super_ = 'super::';

@@ -33,4 +28,4 @@ const assign = ([n]) => `${n}: Self::${n},`;

const this_ = ['this: &Object'];
const rustType = n => `pub type ${n} = nanocom::${n}<Interface>;`;
const whereContent = h => wh => {
const rustType = (n) => `pub type ${n} = nanocom::${n}<Interface>;`;
const whereContent = (h) => (wh) => {
const w = 'where' in wh ? [

@@ -48,3 +43,3 @@ h,

};
const rustImpl = i => {
const rustImpl = (i) => {
const p = 'param' in i ? `<${i.param}>` : '';

@@ -56,3 +51,3 @@ const header = `impl${p} ${i.trait} for ${i.type}`;

const mapComma = map(comma);
const trait = t => {
const trait = (t) => {
const p = t.pub === true ? 'pub ' : '';

@@ -62,3 +57,3 @@ const h = `${p}trait ${t.type}`;

};
const traitImpl = t => {
const traitImpl = (t) => {
const i = rustImpl({

@@ -81,4 +76,4 @@ param: 'T',

export const rust = (library) => {
const type = p => {
const f = o => t => {
const type = (p) => {
const f = (o) => (t) => {
if (typeof t === 'string') {

@@ -96,3 +91,3 @@ return t;

};
const pf = p => o => ([name, t]) => `${name}: ${type(p)(o)(t)}`;
const pf = (p) => (o) => ([name, t]) => `${name}: ${type(p)(o)(t)}`;
const param = pf(super_)(obj);

@@ -105,3 +100,3 @@ const mapParam = map(param);

.result;
const func = first => p => {
const func = (first) => (p) => {
const resultStr = '_' in p ? ` -> ${type(super_)(ref)(p._)}` : '';

@@ -111,9 +106,9 @@ const params = commaJoin(flat([first, mapParam(paramList(p))]));

};
const virtualFnType = n => p => `extern "system" fn${n}${func(this_)(p)}`;
const virtualFnType = (n) => (p) => `extern "system" fn${n}${func(this_)(p)}`;
const virtualFn = ([n, p]) => `${n}: unsafe ${virtualFnType('')(p)}`;
const mapVirtualFn = map(virtualFn);
const headerFn = ([n, p]) => `fn ${n}${func(self)(p)}`;
const traitFn = m => `${headerFn(m)};`;
const traitFn = (m) => `${headerFn(m)};`;
const mapTraitFn = map(traitFn);
const implFn = m => {
const implFn = (m) => {
const [n, p] = m;

@@ -136,3 +131,3 @@ return [

const flatMapImpl = flatMap(impl);
const interface_ = ({ interface: i, guid }) => name => {
const interface_ = ({ interface: i, guid }) => (name) => {
const e = entries(i);

@@ -139,0 +134,0 @@ return [

@@ -5,3 +5,3 @@ import { flat } from "../../types/list/module.f.js";

import rustContent from "../rust/testlib.f.js";
const flags = platform => {
const flags = (platform) => {
switch (platform) {

@@ -16,3 +16,3 @@ case 'win32':

};
const output = platform => name => {
const output = (platform) => (name) => {
switch (platform) {

@@ -19,0 +19,0 @@ case 'win32': return `${name}.dll`;

@@ -1,2 +0,2 @@

import * as O from '../../types/object/module.f.ts';
import type * as O from '../../types/object/module.f.ts';
import { type List } from '../../types/list/module.f.ts';

@@ -3,0 +3,0 @@ export type Library = {

@@ -1,2 +0,1 @@

import * as O from "../../types/object/module.f.js";
import { filter } from "../../types/list/module.f.js";

@@ -8,2 +7,2 @@ import { compose } from "../../types/function/module.f.js";

export const paramList = compose(entries)(filterParam);
export const result = v => f => fa => '_' in fa ? f(fa._) : v;
export const result = (v) => (f) => (fa) => '_' in fa ? f(fa._) : v;

@@ -1,2 +0,1 @@

import * as _ from "./module.f.js";
export default {

@@ -3,0 +2,0 @@ Slice: {

@@ -1,6 +0,6 @@

import * as package_ from '../package/module.f.ts';
import type * as package_ from '../package/module.f.ts';
import { type MapInterface, type Id, type State } from '../module/module.f.ts';
import * as function_ from '../module/function/module.f.ts';
import type * as function_ from '../module/function/module.f.ts';
type Result<M> = readonly [State, M];
export declare const getOrBuild: (compile: function_.Compile) => (packageGet: package_.Get) => <M>(moduleMapInterface: MapInterface<M>) => (moduleId: Id) => (moduleMap: M) => Result<M>;
export {};

@@ -1,6 +0,3 @@

import * as package_ from "../package/module.f.js";
import { idToString, dir, } from "../module/module.f.js";
import * as function_ from "../module/function/module.f.js";
import * as map from "../../types/map/module.f.js";
const { empty: mapEmpty, setReplace } = map;
import { empty as mapEmpty, setReplace } from "../../types/map/module.f.js";
import * as object from "../../types/object/module.f.js";

@@ -12,3 +9,3 @@ const { fromMap } = object;

const { set: setSet, contains: setContains, empty: stringSetEmpty } = stringSet;
const notFound = moduleMap => [['error', ['file not found']], moduleMap];
const notFound = (moduleMap) => [['error', ['file not found']], moduleMap];
export const getOrBuild = compile => packageGet => moduleMapInterface => {

@@ -51,3 +48,3 @@ const build = buildSet => moduleId => {

};
const f = moduleId => moduleMap => {
const f = (moduleId) => (moduleMap) => {
const moduleIdStr = idToString(moduleId);

@@ -54,0 +51,0 @@ // check moduleMap

import * as _ from "./module.f.js";
import * as map from "../../types/map/module.f.js";
import * as Module from "../module/module.f.js";
import * as ModuleFunction from "../module/function/module.f.js";
import * as Result from "../../types/result/module.f.js";
import * as Package from "../package/module.f.js";
import { at } from "../../types/object/module.f.js";

@@ -8,0 +4,0 @@ const compileMap = {

/**
* An IO interface for creating and running module functions.
*/
import * as TypesResult from '../../../types/result/module.f.ts';
import type * as TypesResult from '../../../types/result/module.f.ts';
export type Function_ = <M>(require: Require<M>) => (prior: M) => Result<M>;

@@ -6,0 +6,0 @@ export type Result<M> = readonly [TypesResult.Result<unknown, unknown>, M];

/**
* An IO interface for creating and running module functions.
*/
import * as TypesResult from "../../../types/result/module.f.js";
export {};

@@ -1,2 +0,2 @@

import * as O from '../../types/object/module.f.ts';
import type * as O from '../../types/object/module.f.ts';
export type MapInterface<M> = {

@@ -3,0 +3,0 @@ readonly at: (moduleId: string) => (moduleMap: M) => State | null;

@@ -1,3 +0,2 @@

import * as O from "../../types/object/module.f.js";
export const dir = id => {
export const dir = (id) => {
const len = id.path.length;

@@ -12,2 +11,2 @@ if (len < 1) {

};
export const idToString = id => `${id.package}/${id.path.join('/')}`;
export const idToString = (id) => `${id.package}/${id.path.join('/')}`;
import { type List } from '../../types/list/module.f.ts';
import * as Package from '../package/module.f.ts';
import * as Module from '../module/module.f.ts';
import type * as Package from '../package/module.f.ts';
import type * as Module from '../module/module.f.ts';
type Items = readonly string[];

@@ -11,3 +11,3 @@ type LocalPath = {

export declare const parseLocal: (local: string) => (path: string) => LocalPath | null;
type Path = {
export type Path = {
readonly package: string;

@@ -19,8 +19,8 @@ readonly items: Items;

export declare const parse: (packageId: string) => (dependencies: (local: string) => string | null) => (local: string) => (path: string) => Path | null;
type FoundResult = {
export type FoundResult = {
readonly id: Module.Id;
readonly source: string;
};
type Result = FoundResult | null;
export type Result = FoundResult | null;
export declare const parseAndFind: (packageGet: Package.Get) => (moduleId: Module.Id) => (path: string) => Result;
export {};
import { next, fold, reverse, first, flat, toArray, filterMap, isEmpty, concat, empty } from "../../types/list/module.f.js";
import { join } from "../../types/string/module.f.js";
import * as Package from "../package/module.f.js";
import * as Module from "../module/module.f.js";
const split = path => path.split('/');
const normItemsOp = first => prior => {
const normItemsOp = (first) => (prior) => {
if (prior === null) {

@@ -28,3 +26,3 @@ return null;

};
const normItems = items => {
const normItems = (items) => {
const result = fold(normItemsOp)([empty])(items);

@@ -34,4 +32,4 @@ return result === null ? result : [reverse(result[0])];

const firstNull = first(null);
export const parseLocal = local => {
const fSeq = path => {
export const parseLocal = (local) => {
const fSeq = (path) => {
const pathSeq = split(path);

@@ -56,3 +54,3 @@ const dir = [null, '', '.', '..'].includes(pathSeq[pathSeq.length - 1]);

};
const variants = prior => () => {
const variants = (prior) => () => {
const [a, b] = prior;

@@ -67,3 +65,3 @@ const r = next(b);

};
const mapDependency = d => ([external, internal]) => {
const mapDependency = (d) => ([external, internal]) => {
const id = d(external);

@@ -70,0 +68,0 @@ return id === null ? null : [id, internal];

@@ -6,4 +6,3 @@ import * as _ from "./module.f.js";

import { at } from "../../types/object/module.f.js";
import * as Package from "../package/module.f.js";
const i = o => s => at(s)(o);
const i = (o) => (s) => at(s)(o);
const stringify = json.stringify(identity);

@@ -10,0 +9,0 @@ export default {

@@ -42,3 +42,3 @@ import type * as Operator from '../../types/function/operator/module.f.ts';

*/
export declare const sqrt: (f: PrimeField) => (a: bigint) => bigint | null;
export declare const sqrt: ({ p, mul, pow }: PrimeField) => (a: bigint) => bigint | null;
export {};

@@ -8,3 +8,3 @@ import { repeat } from "../../types/monoid/module.f.js";

*/
export const prime_field = p => {
export const prime_field = (p) => {
const sub = a => b => {

@@ -11,0 +11,0 @@ const r = a - b;

@@ -53,3 +53,3 @@ import type * as Operator from '../../types/function/operator/module.f.ts';

*/
export declare const curve: (i: Init) => Curve;
export declare const curve: ({ p, a: [a0, a1], n }: Init) => Curve;
export declare const eq: (a: Point) => (b: Point) => boolean;

@@ -56,0 +56,0 @@ /**

@@ -34,3 +34,3 @@ import { prime_field, sqrt } from "../prime_field/module.f.js";

*/
const y2 = x => addA0(add(pow3(x))(mulA1(x)));
const y2 = (x) => addA0(add(pow3(x))(mulA1(x)));
const addPoint = p => q => {

@@ -77,3 +77,3 @@ if (p === null) {

};
export const eq = a => b => {
export const eq = (a) => (b) => {
if (a === null || b === null) {

@@ -80,0 +80,0 @@ return a === b;

@@ -1,13 +0,76 @@

import * as array from '../../types/array/module.f.ts';
type HashInput = {
readonly f: (i: number) => number;
readonly length: number;
import type { Array16, Array8 } from '../../types/array/module.f.ts';
import { type Vec } from '../../types/bit_vec/module.f.ts';
export type V8 = Array8<bigint>;
export type V16 = Array16<bigint>;
/**
* Type definition for the state of the SHA-2 algorithm.
*/
export type State = {
/**
* The current hash value.
*/
readonly hash: V8;
/**
* The length of the data processed so far.
*/
readonly len: bigint;
/**
* The remaining data that has not yet been processed.
*/
readonly remainder: Vec;
};
type Hash8 = array.Array8<number>;
type Array16 = array.Array16<number>;
export declare const padding: (input: readonly number[]) => (bits: number) => HashInput;
export declare const computeSha256: (input: readonly number[]) => (bitsCount: number) => Hash8;
export declare const computeSha224: (input: readonly number[]) => (bitsCount: number) => Hash8;
export declare const compress256: (data: Array16) => Hash8;
export declare const compress224: (data: Array16) => Hash8;
export {};
export type Base = {
readonly bitLength: bigint;
readonly chunkLength: bigint;
readonly compress: (i: V8) => (u: bigint) => V8;
readonly fromV8: (a: V8) => bigint;
readonly append: (state: State) => (v: Vec) => State;
readonly end: (hashLength: bigint) => (state: State) => bigint;
};
/**
* SHA2. See https://en.wikipedia.org/wiki/SHA-2
*
* @example
*
* ```js
* const s = msbUtf8("The quick brown fox jumps over the lazy dog.")
* let state = sha224.init
* state = sha224.append(state)(s)
* const h = sha224.end(state) // 0x619cba8e8e05826e9b8c519c0a5c68f4fb653e8a3d8aa04bb2c8cd4cn
* ```
*/
export type Sha2 = {
/**
* Initial state of the SHA-2 algorithm.
*/
readonly init: State;
/**
* Appends data to the state and returns the new state.
*
* @param state The current state.
* @param v The data to append.
* @returns The new state after appending data.
*/
readonly append: (state: State) => (v: Vec) => State;
/**
* Finalizes the hash and returns the result as a bigint.
*
* @param state The final state.
* @returns The resulting hash.
*/
readonly end: (state: State) => bigint;
};
export declare const base32: Base;
export declare const base64: Base;
/** SHA-256 */
export declare const sha256: Sha2;
/** SHA-224 */
export declare const sha224: Sha2;
/** SHA-512 */
export declare const sha512: Sha2;
/** SHA-384 */
export declare const sha384: Sha2;
/** SHA-512/256 */
export declare const sha512x256: Sha2;
/** SHA-512/224 */
export declare const sha512x224: Sha2;

@@ -1,145 +0,252 @@

import * as array from "../../types/array/module.f.js";
const appendOneWithZeros = input => pos => (input >> pos << pos) | (1 << pos);
const mod = a => b => (a % b + b) % b;
export const padding = input => bitsCount => {
const appendBlockIndex = (bitsCount / 32) | 0;
const length = (bitsCount + mod(447 - bitsCount)(512) + 65) / 32;
const f = i => {
if (i < appendBlockIndex) {
return input[i];
import { mask } from "../../types/bigint/module.f.js";
import { vec, length, empty, msb } from "../../types/bit_vec/module.f.js";
const { concat, popFront, front } = msb;
const lastOne = vec(1n)(1n);
const base = ({ logBitLen, k, bs0, bs1, ss0, ss1 }) => {
const bitLength = 1n << logBitLen;
const rotr = (d) => {
const r = bitLength - d;
return (n) => n >> d | n << r;
};
const bigSigma = ([a, b, c]) => {
const ra = rotr(a);
const rb = rotr(b);
const rc = rotr(c);
return (x) => ra(x) ^ rb(x) ^ rc(x);
};
const bigSigma0 = bigSigma(bs0);
const bigSigma1 = bigSigma(bs1);
const smallSigma = ([a, b, c]) => {
const ra = rotr(a);
const rb = rotr(b);
return (x) => ra(x) ^ rb(x) ^ (x >> c);
};
const smallSigma0 = smallSigma(ss0);
const smallSigma1 = smallSigma(ss1);
const ch = (x, y, z) => x & y ^ ~x & z;
const maj = (x, y, z) => x & y ^ x & z ^ y & z;
const m = mask(bitLength);
const wi = ([a0, a1, a2, a3]) => (smallSigma1(a0) + a1 + smallSigma0(a2) + a3) & m;
const nextW = ([w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, wA, wB, wC, wD, wE, wF]) => {
w0 = wi([wE, w9, w1, w0]);
w1 = wi([wF, wA, w2, w1]);
w2 = wi([w0, wB, w3, w2]);
w3 = wi([w1, wC, w4, w3]);
w4 = wi([w2, wD, w5, w4]);
w5 = wi([w3, wE, w6, w5]);
w6 = wi([w4, wF, w7, w6]);
w7 = wi([w5, w0, w8, w7]);
w8 = wi([w6, w1, w9, w8]);
w9 = wi([w7, w2, wA, w9]);
wA = wi([w8, w3, wB, wA]);
wB = wi([w9, w4, wC, wB]);
wC = wi([wA, w5, wD, wC]);
wD = wi([wB, w6, wE, wD]);
wE = wi([wC, w7, wF, wE]);
wF = wi([wD, w8, w0, wF]);
return [w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, wA, wB, wC, wD, wE, wF];
};
const kLength = k.length;
const compressV16 = ([a0, b0, c0, d0, e0, f0, g0, h0]) => (data) => {
let w = data;
let a = a0;
let b = b0;
let c = c0;
let d = d0;
let e = e0;
let f = f0;
let g = g0;
let h = h0;
let i = 0;
while (true) {
const ki = k[i];
for (let j = 0; j < 16; ++j) {
const t1 = h + bigSigma1(e) + ch(e, f, g) + ki[j] + w[j];
const t2 = bigSigma0(a) + maj(a, b, c);
h = g;
g = f;
f = e;
e = (d + t1) & m;
d = c;
c = b;
b = a;
a = (t1 + t2) & m;
}
++i;
if (i === kLength) {
break;
}
w = nextW(w);
}
if (i === appendBlockIndex) {
return appendBlockIndex >= input.length ? 0x8000_0000 : appendOneWithZeros(input[appendBlockIndex])(31 - bitsCount % 32);
return [
(a0 + a) & m,
(b0 + b) & m,
(c0 + c) & m,
(d0 + d) & m,
(e0 + e) & m,
(f0 + f) & m,
(g0 + g) & m,
(h0 + h) & m,
];
};
const at = (u) => (i) => (u >> (i << logBitLen)) & m;
const compress = (i) => (u) => {
const a = at(u);
return compressV16(i)([
a(15n),
a(14n),
a(13n),
a(12n),
a(11n),
a(10n),
a(9n),
a(8n),
a(7n),
a(6n),
a(5n),
a(4n),
a(3n),
a(2n),
a(1n),
a(0n),
]);
};
const chunkLength = bitLength << 4n; // * 16
const fromV8 = (a) => a.reduce((p, v) => (p << bitLength) | v);
const lastChunkLength = chunkLength - 65n;
return {
bitLength,
chunkLength,
compress,
fromV8,
append: (state) => (v) => {
let { remainder, hash, len } = state;
remainder = concat(remainder)(v);
let remainderLen = length(remainder);
while (remainderLen >= chunkLength) {
const [u, nr] = popFront(chunkLength)(remainder);
hash = compress(hash)(u);
remainder = nr;
remainderLen -= chunkLength;
len += chunkLength;
}
return {
hash,
len,
remainder
};
},
end: (hashLength) => {
const offset = (bitLength << 3n) - hashLength;
return (state) => {
const { len, remainder } = state;
let { hash } = state;
const rLen = length(remainder);
let u = front(chunkLength)(concat(remainder)(lastOne));
// last chunk overflow
if (rLen > lastChunkLength) {
hash = compress(hash)(u);
u = 0n;
}
return fromV8(compress(hash)(u | (len + rLen))) >> offset;
};
}
if (i === length - 2) {
return (bitsCount / 0x1_0000_0000) | 0;
}
if (i === length - 1) {
return bitsCount % 0x1_0000_0000;
}
return 0;
};
return ({ f, length });
};
const rotr = d => {
const r = 32 - d;
return n => n >>> d | n << r;
};
const ch = x => y => z => x & y ^ ~x & z;
const maj = x => y => z => x & y ^ x & z ^ y & z;
const shr = d => n => n >>> d;
const bigSigma = a => b => c => {
const ra = rotr(a);
const rb = rotr(b);
const rc = rotr(c);
return x => ra(x) ^ rb(x) ^ rc(x);
};
const bigSigma0 = bigSigma(2)(13)(22);
const bigSigma1 = bigSigma(6)(11)(25);
const smallSigma = a => b => c => {
const ra = rotr(a);
const rb = rotr(b);
const sc = shr(c);
return x => ra(x) ^ rb(x) ^ sc(x);
};
const smallSigma0 = smallSigma(7)(18)(3);
const smallSigma1 = smallSigma(17)(19)(10);
const wi = ([a0, a1, a2, a3]) => (smallSigma1(a0) + a1 + smallSigma0(a2) + a3) | 0;
const nextW = ([w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, wA, wB, wC, wD, wE, wF]) => {
w0 = wi([wE, w9, w1, w0]);
w1 = wi([wF, wA, w2, w1]);
w2 = wi([w0, wB, w3, w2]);
w3 = wi([w1, wC, w4, w3]);
w4 = wi([w2, wD, w5, w4]);
w5 = wi([w3, wE, w6, w5]);
w6 = wi([w4, wF, w7, w6]);
w7 = wi([w5, w0, w8, w7]);
w8 = wi([w6, w1, w9, w8]);
w9 = wi([w7, w2, wA, w9]);
wA = wi([w8, w3, wB, wA]);
wB = wi([w9, w4, wC, wB]);
wC = wi([wA, w5, wD, wC]);
wD = wi([wB, w6, wE, wD]);
wE = wi([wC, w7, wF, wE]);
wF = wi([wD, w8, w0, wF]);
return [w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, wA, wB, wC, wD, wE, wF];
};
const k = [
[
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
const sha2 = ({ append, end }, hash, hashLength) => ({
init: {
hash,
len: 0n,
remainder: empty,
},
append,
end: end(hashLength),
});
export const base32 = base({
logBitLen: 5n,
k: [
[
0x428a2f98n, 0x71374491n, 0xb5c0fbcfn, 0xe9b5dba5n, 0x3956c25bn, 0x59f111f1n, 0x923f82a4n, 0xab1c5ed5n,
0xd807aa98n, 0x12835b01n, 0x243185ben, 0x550c7dc3n, 0x72be5d74n, 0x80deb1fen, 0x9bdc06a7n, 0xc19bf174n,
],
[
0xe49b69c1n, 0xefbe4786n, 0x0fc19dc6n, 0x240ca1ccn, 0x2de92c6fn, 0x4a7484aan, 0x5cb0a9dcn, 0x76f988dan,
0x983e5152n, 0xa831c66dn, 0xb00327c8n, 0xbf597fc7n, 0xc6e00bf3n, 0xd5a79147n, 0x06ca6351n, 0x14292967n,
],
[
0x27b70a85n, 0x2e1b2138n, 0x4d2c6dfcn, 0x53380d13n, 0x650a7354n, 0x766a0abbn, 0x81c2c92en, 0x92722c85n,
0xa2bfe8a1n, 0xa81a664bn, 0xc24b8b70n, 0xc76c51a3n, 0xd192e819n, 0xd6990624n, 0xf40e3585n, 0x106aa070n,
],
[
0x19a4c116n, 0x1e376c08n, 0x2748774cn, 0x34b0bcb5n, 0x391c0cb3n, 0x4ed8aa4an, 0x5b9cca4fn, 0x682e6ff3n,
0x748f82een, 0x78a5636fn, 0x84c87814n, 0x8cc70208n, 0x90befffan, 0xa4506cebn, 0xbef9a3f7n, 0xc67178f2n,
],
],
[
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
bs0: [2n, 13n, 22n],
bs1: [6n, 11n, 25n],
ss0: [7n, 18n, 3n],
ss1: [17n, 19n, 10n],
});
export const base64 = base({
logBitLen: 6n,
k: [
[
0x428a2f98d728ae22n, 0x7137449123ef65cdn, 0xb5c0fbcfec4d3b2fn, 0xe9b5dba58189dbbcn,
0x3956c25bf348b538n, 0x59f111f1b605d019n, 0x923f82a4af194f9bn, 0xab1c5ed5da6d8118n,
0xd807aa98a3030242n, 0x12835b0145706fben, 0x243185be4ee4b28cn, 0x550c7dc3d5ffb4e2n,
0x72be5d74f27b896fn, 0x80deb1fe3b1696b1n, 0x9bdc06a725c71235n, 0xc19bf174cf692694n,
],
[
0xe49b69c19ef14ad2n, 0xefbe4786384f25e3n, 0x0fc19dc68b8cd5b5n, 0x240ca1cc77ac9c65n,
0x2de92c6f592b0275n, 0x4a7484aa6ea6e483n, 0x5cb0a9dcbd41fbd4n, 0x76f988da831153b5n,
0x983e5152ee66dfabn, 0xa831c66d2db43210n, 0xb00327c898fb213fn, 0xbf597fc7beef0ee4n,
0xc6e00bf33da88fc2n, 0xd5a79147930aa725n, 0x06ca6351e003826fn, 0x142929670a0e6e70n,
],
[
0x27b70a8546d22ffcn, 0x2e1b21385c26c926n, 0x4d2c6dfc5ac42aedn, 0x53380d139d95b3dfn,
0x650a73548baf63den, 0x766a0abb3c77b2a8n, 0x81c2c92e47edaee6n, 0x92722c851482353bn,
0xa2bfe8a14cf10364n, 0xa81a664bbc423001n, 0xc24b8b70d0f89791n, 0xc76c51a30654be30n,
0xd192e819d6ef5218n, 0xd69906245565a910n, 0xf40e35855771202an, 0x106aa07032bbd1b8n,
],
[
0x19a4c116b8d2d0c8n, 0x1e376c085141ab53n, 0x2748774cdf8eeb99n, 0x34b0bcb5e19b48a8n,
0x391c0cb3c5c95a63n, 0x4ed8aa4ae3418acbn, 0x5b9cca4f7763e373n, 0x682e6ff3d6b2b8a3n,
0x748f82ee5defb2fcn, 0x78a5636f43172f60n, 0x84c87814a1f0ab72n, 0x8cc702081a6439ecn,
0x90befffa23631e28n, 0xa4506cebde82bde9n, 0xbef9a3f7b2c67915n, 0xc67178f2e372532bn,
],
[
0xca273eceea26619cn, 0xd186b8c721c0c207n, 0xeada7dd6cde0eb1en, 0xf57d4f7fee6ed178n,
0x06f067aa72176fban, 0x0a637dc5a2c898a6n, 0x113f9804bef90daen, 0x1b710b35131c471bn,
0x28db77f523047d84n, 0x32caab7b40c72493n, 0x3c9ebe0a15c9bebcn, 0x431d67c49c100d4cn,
0x4cc5d4becb3e42b6n, 0x597f299cfc657e2an, 0x5fcb6fab3ad6faecn, 0x6c44198c4a475817n,
],
],
[
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
],
[
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
],
];
const compress = ([a0, b0, c0, d0, e0, f0, g0, h0]) => data => {
let w = data;
let a = a0;
let b = b0;
let c = c0;
let d = d0;
let e = e0;
let f = f0;
let g = g0;
let h = h0;
let i = 0;
while (true) {
const ki = k[i];
for (let j = 0; j < 16; ++j) {
const t1 = h + bigSigma1(e) + ch(e)(f)(g) + ki[j] + w[j];
const t2 = bigSigma0(a) + maj(a)(b)(c);
h = g;
g = f;
f = e;
e = (d + t1) | 0;
d = c;
c = b;
b = a;
a = (t1 + t2) | 0;
}
if (i === 3) {
break;
}
++i;
w = nextW(w);
}
return [
(a0 + a) | 0,
(b0 + b) | 0,
(c0 + c) | 0,
(d0 + d) | 0,
(e0 + e) | 0,
(f0 + f) | 0,
(g0 + g) | 0,
(h0 + h) | 0,
];
};
const compute = init => input => bitsCount => {
const { f, length } = padding(input)(bitsCount);
let result = init;
const chunkCount = length / 16;
for (let i = 0; i < chunkCount; i++) {
const s = i * 16;
result = compress(result)([
f(s + 0), f(s + 1), f(s + 2), f(s + 3), f(s + 4), f(s + 5), f(s + 6), f(s + 7),
f(s + 8), f(s + 9), f(s + 10), f(s + 11), f(s + 12), f(s + 13), f(s + 14), f(s + 15)
]);
}
return result;
};
const init256 = [0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19];
export const computeSha256 = compute(init256);
const init224 = [0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4];
export const computeSha224 = compute(init224);
export const compress256 = compress(init256);
export const compress224 = compress(init224);
bs0: [28n, 34n, 39n],
bs1: [14n, 18n, 41n],
ss0: [1n, 8n, 7n],
ss1: [19n, 61n, 6n],
});
/** SHA-256 */
export const sha256 = sha2(base32, [0x6a09e667n, 0xbb67ae85n, 0x3c6ef372n, 0xa54ff53an, 0x510e527fn, 0x9b05688cn, 0x1f83d9abn, 0x5be0cd19n], 256n);
/** SHA-224 */
export const sha224 = sha2(base32, [0xc1059ed8n, 0x367cd507n, 0x3070dd17n, 0xf70e5939n, 0xffc00b31n, 0x68581511n, 0x64f98fa7n, 0xbefa4fa4n], 224n);
/** SHA-512 */
export const sha512 = sha2(base64, [
0x6a09e667f3bcc908n, 0xbb67ae8584caa73bn, 0x3c6ef372fe94f82bn, 0xa54ff53a5f1d36f1n,
0x510e527fade682d1n, 0x9b05688c2b3e6c1fn, 0x1f83d9abfb41bd6bn, 0x5be0cd19137e2179n,
], 512n);
/** SHA-384 */
export const sha384 = sha2(base64, [
0xcbbb9d5dc1059ed8n, 0x629a292a367cd507n, 0x9159015a3070dd17n, 0x152fecd8f70e5939n,
0x67332667ffc00b31n, 0x8eb44a8768581511n, 0xdb0c2e0d64f98fa7n, 0x47b5481dbefa4fa4n,
], 384n);
/** SHA-512/256 */
export const sha512x256 = sha2(base64, [
0x22312194fc2bf72cn, 0x9f555fa3c84c64c2n, 0x2393b86b6f53b151n, 0x963877195940eabdn,
0x96283ee2a88effe3n, 0xbe5e1e2553863992n, 0x2b0199fc2c85b8aan, 0x0eb72ddc81c52ca2n,
], 256n);
/** SHA-512/224 */
export const sha512x224 = sha2(base64, [
0x8c3d37c819544da2n, 0x73e1996689dcd4d6n, 0x1dfab7ae32ff9c82n, 0x679dd514582f9fcfn,
0x0f6d2b697bd44da8n, 0x77e36f7304c48942n, 0x3f9d85a86a1d36c8n, 0x1112e6ad91d692a1n,
], 224n);
declare const _default: {
empty: {
base: {
b32: () => {
s256: () => void;
s224: () => void;
};
b64: () => {
s512: () => void;
s385: () => void;
s512x256: () => void;
s512x224: () => void;
};
};
sha2: {
sha256: () => void;
sha224: () => void;
sha512: () => void;
sha384: () => void;
sha512x256: () => void;
sha512x224: () => void;
};
sha224compress: (() => void)[];
sha256: (() => void)[];
utf8: (() => void)[];
fill: () => {
8: () => void;
16: () => void;
};
};
export default _default;

@@ -1,82 +0,135 @@

import * as _ from "./module.f.js";
import * as json from "../../json/module.f.js";
import { sort } from "../../types/object/module.f.js";
const toU32 = x => (x + 0x1_0000_0000) % 0x1_0000_0000;
const toHexString = x => toU32(x).toString(16).padStart(8, '0');
const stringify = a => json.stringify(sort)(a);
// {
// const result = _.padding([])(0)
// console.log(result.map(toHexString))
// }
// {
// const result = _.padding([0x61626364, 0x65000000])(40)
// console.log(result.map(toHexString))
// }
// {
// const result = _.padding([0x11111110])(31)
// console.log(result.map(toHexString))
// }
// {
// const result = _.padding([0x11111110])(32)
// console.log(result.map(toHexString))
// }
import { msbUtf8 } from "../../text/module.f.js";
import { empty, msb, vec } from "../../types/bit_vec/module.f.js";
import { repeat } from "../../types/monoid/module.f.js";
import { base32, base64, sha224, sha256, sha384, sha512, sha512x224, sha512x256, } from "./module.f.js";
const { concat: beConcat } = msb;
const checkEmpty = ({ init, end }) => (x) => {
const result = end(init);
if (result !== x) {
throw [result, x];
}
};
// https://en.wikipedia.org/wiki/SHA-2#Test_vectors
//
// https://csrc.nist.gov/Projects/Cryptographic-Algorithm-Validation-Program/Secure-Hashing
export default {
empty: {
sha256: () => {
const hash = _.computeSha256([])(0);
const result = stringify(hash.map(toHexString));
if (result !== '["e3b0c442","98fc1c14","9afbf4c8","996fb924","27ae41e4","649b934c","a495991b","7852b855"]') {
throw result;
}
base: {
b32: () => {
const { fromV8, compress, chunkLength } = base32;
const e = 1n << (chunkLength - 1n);
return {
s256: () => {
const result = fromV8(compress(sha256.init.hash)(e));
const x = 0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855n;
if (result !== x) {
throw [result, x];
}
},
s224: () => {
const result = fromV8(compress(sha224.init.hash)(e)) >> 32n;
const x = 0xd14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42fn;
if (result !== x) {
throw [result, x];
}
},
};
},
sha224: () => {
const hash = _.computeSha224([])(0);
const result = stringify(hash.map(toHexString));
if (result !== '["d14a028c","2a3a2bc9","476102bb","288234c4","15a2b01f","828ea62a","c5b3e42f","bdd387cb"]') {
throw result;
}
b64: () => {
const { fromV8, compress, chunkLength } = base64;
const e = 1n << (chunkLength - 1n);
return {
s512: () => {
const result = fromV8(compress(sha512.init.hash)(e));
const x = 0xcf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3en;
if (result !== x) {
throw [result, x];
}
},
s385: () => {
const result = fromV8(compress(sha384.init.hash)(e)) >> 128n;
const x = 0x38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95bn;
if (result !== x) {
throw [result, x];
}
},
s512x256: () => {
const result = fromV8(base64.compress(sha512x256.init.hash)(e)) >> 256n;
const x = 0xc672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967an;
if (result !== x) {
throw [result, x];
}
},
s512x224: () => {
const result = fromV8(compress(sha512x224.init.hash)(e)) >> 288n;
const x = 0x6ed0dd02806fa89e25de060c19d3ac86cabb87d6a0ddd05c333b84f4n;
if (result !== x) {
throw [result, x];
}
},
};
}
},
sha224compress: [
sha2: {
sha256: () => checkEmpty(sha256)(0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855n),
sha224: () => checkEmpty(sha224)(0xd14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42fn),
sha512: () => checkEmpty(sha512)(0xcf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3en),
sha384: () => checkEmpty(sha384)(0x38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95bn),
sha512x256: () => checkEmpty(sha512x256)(0xc672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967an),
sha512x224: () => checkEmpty(sha512x224)(0x6ed0dd02806fa89e25de060c19d3ac86cabb87d6a0ddd05c333b84f4n),
},
utf8: [
() => {
const hash = _.compress224([0x8000_0000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
const result = stringify(hash.map(toHexString));
if (result !== '["d14a028c","2a3a2bc9","476102bb","288234c4","15a2b01f","828ea62a","c5b3e42f","bdd387cb"]') {
throw result;
const s = msbUtf8("The quick brown fox jumps over the lazy dog");
let state = sha224.init;
state = sha224.append(state)(s);
const h = sha224.end(state);
if (h !== 0x730e109bd7a8a32b1cb9d9a09aa2325d2430587ddbc0c38bad911525n) {
throw h;
}
}
],
sha256: [
() => {
//[0x68656C6C, 0x6F20776F, 0x726C6400] represents phrase 'hello world'
const hash = _.computeSha256([0x68656C6C, 0x6F20776F, 0x726C6400])(88);
const result = stringify(hash.map(toHexString));
if (result !== '["b94d27b9","934d3e08","a52e52d7","da7dabfa","c484efe3","7a5380ee","9088f7ac","e2efcde9"]') {
throw result;
}
},
() => {
//[0x68656C6C, 0x6F20776F, 0x726C6488] represents phrase 'hello world' with 1's at the end
const hash = _.computeSha256([0x68656C6C, 0x6F20776F, 0x726C64FF])(88);
const result = stringify(hash.map(toHexString));
if (result !== '["b94d27b9","934d3e08","a52e52d7","da7dabfa","c484efe3","7a5380ee","9088f7ac","e2efcde9"]') {
throw result;
const s = msbUtf8("The quick brown fox jumps over the lazy dog.");
let state = sha224.init;
state = sha224.append(state)(s);
const h = sha224.end(state);
if (h !== 0x619cba8e8e05826e9b8c519c0a5c68f4fb653e8a3d8aa04bb2c8cd4cn) {
throw h;
}
},
() => {
const input = Array(8).fill(0x31313131);
const result = _.computeSha256(input)(256);
if (toU32(result[0]) !== 0x8a83665f) {
throw result[0];
const s = msbUtf8("hello world");
if (s !== 0x168656c6c6f20776f726c64n) {
throw s;
}
},
() => {
const input = Array(16).fill(0x31313131);
const hash = _.computeSha256(input)(512);
const result = stringify(hash.map(toHexString));
if (result !== '["3138bb9b","c78df27c","473ecfd1","410f7bd4","5ebac1f5","9cf3ff9c","fe4db77a","ab7aedd3"]') {
throw result;
let state = sha256.init;
state = sha256.append(state)(s);
const h = sha256.end(state);
if (h !== 0xb94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9n) {
throw h;
}
}
]
],
fill: () => {
const times = repeat({ identity: empty, operation: beConcat })(vec(32n)(0x31313131n));
return {
8: () => {
const r = times(8n);
let state = sha256.init;
state = sha256.append(state)(r);
const h = sha256.end(state);
if (h >> 224n !== 0x8a83665fn) {
throw h;
}
},
16: () => {
const r = times(16n);
let state = sha256.init;
state = sha256.append(state)(r);
const h = sha256.end(state);
if (h !== 0x3138bb9bc78df27c473ecfd1410f7bd45ebac1f59cf3ff9cfe4db77aab7aedd3n) {
throw h;
}
}
};
}
};

@@ -1,5 +0,1 @@

const assert = () => { throw 'assert'; };
const assert_if = c => { if (c) {
throw 'assert_if';
} };
export default {

@@ -6,0 +2,0 @@ ctor: () => {

@@ -1,2 +0,2 @@

import * as Result from '../../types/result/module.f.ts';
import type * as Result from '../../types/result/module.f.ts';
type Module = {

@@ -3,0 +3,0 @@ readonly default?: unknown;

import { entries, fold } from "../../types/list/module.f.js";
import { reset, fgGreen, fgRed, bold } from "../../text/sgr/module.f.js";
import * as Result from "../../types/result/module.f.js";
const isTest = s => s.endsWith('test.f.mjs') || s.endsWith('test.f.js') || s.endsWith('test.f.ts');
const addPass = delta => ts => ({ ...ts, time: ts.time + delta, pass: ts.pass + 1 });
const addFail = delta => ts => ({ ...ts, time: ts.time + delta, fail: ts.fail + 1 });
const timeFormat = a => {
const isTest = (s) => s.endsWith('test.f.mjs') || s.endsWith('test.f.js') || s.endsWith('test.f.ts');
const addPass = (delta) => (ts) => ({ ...ts, time: ts.time + delta, pass: ts.pass + 1 });
const addFail = (delta) => (ts) => ({ ...ts, time: ts.time + delta, fail: ts.fail + 1 });
const timeFormat = (a) => {
const y = Math.round(a * 10_000).toString();

@@ -9,0 +8,0 @@ const yl = 5 - y.length;

import * as list from '../types/list/module.f.ts';
import * as O from '../types/object/module.f.ts';
import type * as O from '../types/object/module.f.ts';
type Object = {

@@ -4,0 +4,0 @@ readonly [k in string]: Unknown;

@@ -5,3 +5,2 @@ import * as list from "../types/list/module.f.js";

const { concat } = string;
import * as O from "../types/object/module.f.js";
import * as f from "../types/function/module.f.js";

@@ -8,0 +7,0 @@ const { compose, fn } = f;

import * as result from '../../types/result/module.f.ts';
import { type List } from '../../types/list/module.f.ts';
import * as tokenizerT from '../tokenizer/module.f.ts';
import type * as tokenizerT from '../tokenizer/module.f.ts';
export type DjsModule = [readonly string[], readonly DjsConst[]];

@@ -5,0 +5,0 @@ export type DjsConst = boolean | string | number | null | bigint | undefined | DjsModuleRef | DjsArray | DjsObject;

import * as result from "../../types/result/module.f.js";
import { fold, first, drop, toArray, length, concat } from "../../types/list/module.f.js";
import * as Operator from "../../types/function/operator/module.f.js";
import * as tokenizerT from "../tokenizer/module.f.js";
import { setReplace, at } from "../../types/map/module.f.js";

@@ -6,0 +4,0 @@ import * as o from "../../types/object/module.f.js";

import * as list from '../../types/list/module.f.ts';
import * as O from '../../types/object/module.f.ts';
import * as DjsParser from '../parser/module.f.ts';
import type * as O from '../../types/object/module.f.ts';
import type * as DjsParser from '../parser/module.f.ts';
export declare const undefinedSerialize: string[];

@@ -5,0 +5,0 @@ type Entry = O.Entry<DjsParser.DjsConst>;

@@ -5,3 +5,2 @@ import * as list from "../../types/list/module.f.js";

const { concat } = string;
import * as O from "../../types/object/module.f.js";
import * as f from "../../types/function/module.f.js";

@@ -14,3 +13,2 @@ const { compose, fn } = f;

const { objectWrap, arrayWrap, stringSerialize, numberSerialize, nullSerialize, boolSerialize } = j;
import * as DjsParser from "../parser/module.f.js";
const colon = [':'];

@@ -17,0 +15,0 @@ export const undefinedSerialize = ['undefined'];

@@ -1,2 +0,1 @@

import * as Operator from "../../types/function/operator/module.f.js";
import * as list from "../../types/list/module.f.js";

@@ -3,0 +2,0 @@ const { empty, flat, stateScan } = list;

@@ -7,3 +7,2 @@ import * as _ from "./module.f.js";

const s = stringify(i => i);
/** @type {} */
const f = v => {

@@ -10,0 +9,0 @@ const n = one(v);

@@ -84,4 +84,4 @@ import * as list from '../../types/list/module.f.ts';

type ErrorMessage = '" are missing' | 'unescaped character' | 'invalid hex value' | 'unexpected character' | 'invalid number' | 'invalid token' | '*\/ expected' | 'unterminated string literal' | 'eof';
export declare const isKeywordToken: (token: JsToken) => Boolean;
export declare const isKeywordToken: (token: JsToken) => boolean;
export declare const tokenize: (input: list.List<number>) => list.List<JsToken>;
export {};

@@ -488,4 +488,4 @@ import * as operator from "../../types/function/operator/module.f.js";

case 'e-': return [[{ kind: 'error', message: 'invalid number' }], { kind: 'eof', }];
default: return [[bufferToNumberToken(state)], { kind: 'eof' }];
}
return [[bufferToNumberToken(state)], { kind: 'eof' }];
case 'op': return [[getOperatorToken(state.value)], { kind: 'eof' }];

@@ -492,0 +492,0 @@ case '//': return [[{ kind: '//', value: state.value }], { kind: 'eof' }];

import * as result from '../../types/result/module.f.ts';
import * as list from '../../types/list/module.f.ts';
import * as Tokenizer from '../tokenizer/module.f.ts';
import * as Json from '../module.f.ts';
import type * as Tokenizer from '../tokenizer/module.f.ts';
import type * as Json from '../module.f.ts';
export declare const parse: (tokenList: list.List<Tokenizer.JsonToken>) => result.Result<Json.Unknown, string>;
import * as result from "../../types/result/module.f.js";
import * as list from "../../types/list/module.f.js";
const { fold, first, drop, toArray } = list;
import * as Operator from "../../types/function/operator/module.f.js";
import * as Tokenizer from "../tokenizer/module.f.js";
import * as map from "../../types/map/module.f.js";
const { setReplace } = map;
import * as Json from "../module.f.js";
import * as o from "../../types/object/module.f.js";

@@ -10,0 +7,0 @@ const { fromMap } = o;

import * as list from "../../types/list/module.f.js";
const { flat, reduce, empty } = list;
import * as O from "../../types/object/module.f.js";
import * as Operator from "../../types/function/operator/module.f.js";
const jsonStringify = JSON.stringify;

@@ -6,0 +4,0 @@ export const stringSerialize = input => [jsonStringify(input)];

@@ -1,2 +0,1 @@

import * as Operator from "../../types/function/operator/module.f.js";
import * as list from "../../types/list/module.f.js";

@@ -3,0 +2,0 @@ const { empty, flat, stateScan } = list;

{
"name": "functionalscript",
"version": "0.3.7",
"version": "0.3.8",
"type": "module",

@@ -5,0 +5,0 @@ "files": [

@@ -1,2 +0,2 @@

import { type Range } from '../../types/range/module.f.ts';
import type { Range } from '../../types/range/module.f.ts';
export declare const one: (s: string) => number;

@@ -3,0 +3,0 @@ export declare const range: (s: string) => Range;

@@ -1,3 +0,2 @@

import {} from "../../types/range/module.f.js";
const at = s => i => {
const at = (s) => (i) => {
const r = s.codePointAt(i);

@@ -10,3 +9,3 @@ if (r === void 0) {

export const one = (s) => at(s)(0);
export const range = s => {
export const range = (s) => {
const f = at(s);

@@ -13,0 +12,0 @@ const f0 = f(0);

@@ -1,6 +0,4 @@

import * as _ from "./module.f.js";
const { range } = _;
import { range } from "./module.f.js";
import * as json from "../../json/module.f.js";
import * as o from "../../types/object/module.f.js";
const { sort } = o;
import { sort } from "../../types/object/module.f.js";
const stringify = json.stringify(sort);

@@ -7,0 +5,0 @@ export default {

@@ -1,8 +0,23 @@

import * as list from '../types/list/module.f.ts';
import { type Vec } from "../types/bit_vec/module.f.ts";
import { type List } from '../types/list/module.f.ts';
export type Block = ItemThunk | ItemArray;
type ItemArray = readonly Item[];
type ItemThunk = () => list.List<Item>;
type ItemThunk = () => List<Item>;
export type Item = string | ItemArray | ItemThunk;
export declare const flat: (indent: string) => (text: Block) => list.List<string>;
export declare const flat: (indent: string) => (text: Block) => List<string>;
export declare const curly: (type: string) => (name: string) => (body: Block) => Block;
/**
* Converts a string to an UTF-8, represented as an MSB first bit vector.
*
* @param s The input string to be converted.
* @returns The resulting UTF-8 bit vector, MSB first.
*/
export declare const msbUtf8: (s: string) => Vec;
/**
* Converts a UTF-8 bit vector with MSB first encoding to a string.
*
* @param msbV - The UTF-8 bit vector with MSB first encoding.
* @returns The resulting string.
*/
export declare const msbUtf8ToString: (msbV: Vec) => string;
export {};

@@ -1,6 +0,8 @@

import * as list from "../types/list/module.f.js";
const { flatMap } = list;
export const flat = indent => {
const f = prefix => {
const g = item => typeof (item) === 'string' ? [`${prefix}${item}`] : f(`${prefix}${indent}`)(item);
import { msb, u8List, u8ListToVec } from "../types/bit_vec/module.f.js";
import { flatMap } from "../types/list/module.f.js";
import * as utf8 from "./utf8/module.f.js";
import * as utf16 from "./utf16/module.f.js";
export const flat = (indent) => {
const f = (prefix) => {
const g = (item) => typeof (item) === 'string' ? [`${prefix}${item}`] : f(`${prefix}${indent}`)(item);
return flatMap(g);

@@ -10,2 +12,16 @@ };

};
export const curly = type => name => body => [`${type} ${name}`, '{', body, '}'];
export const curly = (type) => (name) => (body) => [`${type} ${name}`, '{', body, '}'];
/**
* Converts a string to an UTF-8, represented as an MSB first bit vector.
*
* @param s The input string to be converted.
* @returns The resulting UTF-8 bit vector, MSB first.
*/
export const msbUtf8 = (s) => u8ListToVec(msb)(utf8.fromCodePointList(utf16.toCodePointList(utf16.stringToList(s))));
/**
* Converts a UTF-8 bit vector with MSB first encoding to a string.
*
* @param msbV - The UTF-8 bit vector with MSB first encoding.
* @returns The resulting string.
*/
export const msbUtf8ToString = (msbV) => utf16.listToString(utf16.fromCodePointList(utf8.toCodePointList(u8List(msb)(msbV))));
/**
* https://en.wikipedia.org/wiki/ANSI_escape_code#SGR
*/
export const sgr = c => `\x1b[${c.toString()}m`;
export const sgr = (c) => `\x1b[${c.toString()}m`;
export const reset = sgr(0);

@@ -6,0 +6,0 @@ export const bold = sgr(1);

@@ -1,2 +0,5 @@

declare const _default: () => void;
declare const _default: {
block: () => void;
encoding: () => void;
};
export default _default;

@@ -1,18 +0,26 @@

import * as _ from "./module.f.js";
import * as string from "../types/string/module.f.js";
const { join } = string;
export default () => {
const text = [
'a',
'b',
() => [
'c',
() => ['d'],
],
'e',
];
const result = join('\n')(_.flat(':')(text));
if (result !== 'a\nb\n:c\n::d\ne') {
throw result;
import { flat, msbUtf8, msbUtf8ToString } from "./module.f.js";
import { join } from "../types/string/module.f.js";
export default {
block: () => {
const text = [
'a',
'b',
() => [
'c',
() => ['d'],
],
'e',
];
const result = join('\n')(flat(':')(text));
if (result !== 'a\nb\n:c\n::d\ne') {
throw result;
}
},
encoding: () => {
const v = msbUtf8('Hello world!');
const r = msbUtf8ToString(v);
if (r !== 'Hello world!') {
throw r;
}
}
};
import { type List, type Thunk } from '../../types/list/module.f.ts';
type u16 = number;
type i32 = number;
type U16 = number;
type I32 = number;
export declare const fromCodePointList: (input: List<number>) => Thunk<number>;
declare const u16: (i: number) => boolean;
export declare const toCodePointList: (input: List<u16>) => List<i32>;
export declare const stringToList: (s: string) => List<u16>;
export declare const listToString: (input: List<u16>) => string;
export declare const toCodePointList: (input: List<U16>) => List<I32>;
export declare const stringToList: (s: string) => List<U16>;
export declare const listToString: (input: List<U16>) => string;
export {};
import { map, flat, stateScan, reduce, flatMap, empty, } from "../../types/list/module.f.js";
import * as operator from "../../types/function/operator/module.f.js";
import { concat } from "../../types/function/operator/module.f.js";
import { contains } from "../../types/range/module.f.js";
import * as f from "../../types/function/module.f.js";
const { fn } = f;
import { fn } from "../../types/function/module.f.js";
const lowBmp = contains([0x0000, 0xd7ff]);
const highBmp = contains([0xe000, 0xffff]);
const isBmpCodePoint = codePoint => lowBmp(codePoint) || highBmp(codePoint);
const isBmpCodePoint = (codePoint) => lowBmp(codePoint) || highBmp(codePoint);
const isHighSurrogate = contains([0xd800, 0xdbff]);

@@ -13,3 +12,3 @@ const isLowSurrogate = contains([0xdc00, 0xdfff]);

const isSupplementaryPlane = contains([0x01_0000, 0x10_ffff]);
const codePointToUtf16 = codePoint => {
const codePointToUtf16 = (codePoint) => {
if (isBmpCodePoint(codePoint)) {

@@ -54,8 +53,8 @@ return [codePoint];

};
const utf16EofToCodePointOp = state => [state === null ? empty : [state | errorMask], null];
const utf16EofToCodePointOp = (state) => [state === null ? empty : [state | errorMask], null];
const utf16ByteOrEofToCodePointOp = state => input => input === null ? utf16EofToCodePointOp(state) : utf16ByteToCodePointOp(state)(input);
const eofList = [null];
export const toCodePointList = input => flat(stateScan(utf16ByteOrEofToCodePointOp)(null)(flat([input, eofList])));
export const stringToList = s => {
const at = i => {
export const toCodePointList = (input) => flat(stateScan(utf16ByteOrEofToCodePointOp)(null)(flat([input, eofList])));
export const stringToList = (s) => {
const at = (i) => {
const first = s.charCodeAt(i);

@@ -67,3 +66,3 @@ return isNaN(first) ? empty : { first, tail: () => at(i + 1) };

export const listToString = fn(map(String.fromCharCode))
.then(reduce(operator.concat)(''))
.then(reduce(concat)(''))
.result;

@@ -1,11 +0,10 @@

import * as encoding from "./module.f.js";
import { toCodePointList, fromCodePointList, stringToList, listToString } from "./module.f.js";
import * as json from "../../json/module.f.js";
import * as o from "../../types/object/module.f.js";
const { sort } = o;
import * as list from "../../types/list/module.f.js";
const stringify = a => json.stringify(sort)(a);
import { sort } from "../../types/object/module.f.js";
import { toArray } from "../../types/list/module.f.js";
const stringify = (a) => json.stringify(sort)(a);
export default {
toCodePointList: [
() => {
const result = stringify(list.toArray(encoding.toCodePointList([-1, 65536])));
const result = stringify(toArray(toCodePointList([-1, 65536])));
if (result !== '[4294967295,4294967295]') {

@@ -16,3 +15,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.toCodePointList([0, 36, 8364, 55295, 57344, 65535])));
const result = stringify(toArray(toCodePointList([0, 36, 8364, 55295, 57344, 65535])));
if (result !== '[0,36,8364,55295,57344,65535]') {

@@ -23,3 +22,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.toCodePointList([56320, 57343])));
const result = stringify(toArray(toCodePointList([56320, 57343])));
if (result !== '[-2147427328,-2147426305]') {

@@ -30,3 +29,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.toCodePointList([55296, 56320, 55297, 56375, 55378, 57186, 56319, 57343])));
const result = stringify(toArray(toCodePointList([55296, 56320, 55297, 56375, 55378, 57186, 56319, 57343])));
if (result !== '[65536,66615,150370,1114111]') {

@@ -37,3 +36,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.toCodePointList([55296, 55296])));
const result = stringify(toArray(toCodePointList([55296, 55296])));
if (result !== '[-2147428352,-2147428352]') {

@@ -44,3 +43,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.toCodePointList([55296, 0])));
const result = stringify(toArray(toCodePointList([55296, 0])));
if (result !== '[-2147428352,0]') {

@@ -51,3 +50,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.toCodePointList([56320])));
const result = stringify(toArray(toCodePointList([56320])));
if (result !== '[-2147427328]') {

@@ -58,3 +57,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.toCodePointList([56320, 0])));
const result = stringify(toArray(toCodePointList([56320, 0])));
if (result !== '[-2147427328,0]') {

@@ -67,3 +66,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([0])));
const result = stringify(toArray(fromCodePointList([0])));
if (result !== '[0]') {

@@ -74,3 +73,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([0x24])));
const result = stringify(toArray(fromCodePointList([0x24])));
if (result !== '[36]') {

@@ -81,3 +80,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([0x20AC])));
const result = stringify(toArray(fromCodePointList([0x20AC])));
if (result !== '[8364]') {

@@ -88,3 +87,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([0xd7ff])));
const result = stringify(toArray(fromCodePointList([0xd7ff])));
if (result !== '[55295]') {

@@ -95,3 +94,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([0xe000])));
const result = stringify(toArray(fromCodePointList([0xe000])));
if (result !== '[57344]') {

@@ -102,3 +101,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([0xffff])));
const result = stringify(toArray(fromCodePointList([0xffff])));
if (result !== '[65535]') {

@@ -109,3 +108,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([0x10000])));
const result = stringify(toArray(fromCodePointList([0x10000])));
if (result !== '[55296,56320]') {

@@ -116,3 +115,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([0x10437])));
const result = stringify(toArray(fromCodePointList([0x10437])));
if (result !== '[55297,56375]') {

@@ -123,3 +122,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([0x24B62])));
const result = stringify(toArray(fromCodePointList([0x24B62])));
if (result !== '[55378,57186]') {

@@ -130,3 +129,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([0x10ffff])));
const result = stringify(toArray(fromCodePointList([0x10ffff])));
if (result !== '[56319,57343]') {

@@ -137,3 +136,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([-1, 0xd800, 0xdfff, 0x110000])));
const result = stringify(toArray(fromCodePointList([-1, 0xd800, 0xdfff, 0x110000])));
if (result !== '[65535,55296,57343,0]') {

@@ -146,4 +145,4 @@ throw result;

() => {
const utf16List = encoding.stringToList("Hello world!😂🚜🚲");
const result = encoding.listToString(utf16List);
const utf16List = stringToList("Hello world!😂🚜🚲");
const result = listToString(utf16List);
if (result !== "Hello world!😂🚜🚲") {

@@ -154,6 +153,6 @@ throw result;

() => {
const a = encoding.stringToList("Hello world!😂🚜🚲");
const b = encoding.toCodePointList(a);
const c = encoding.fromCodePointList(b);
const result = encoding.listToString(c);
const a = stringToList("Hello world!😂🚜🚲");
const b = toCodePointList(a);
const c = fromCodePointList(b);
const result = listToString(c);
if (result !== "Hello world!😂🚜🚲") {

@@ -160,0 +159,0 @@ throw result;

import { type List, type Thunk } from '../../types/list/module.f.ts';
type u8 = number;
type i32 = number;
export declare const fromCodePointList: (input: List<number>) => Thunk<number>;
export declare const toCodePointList: (input: List<u8>) => List<i32>;
export {};
import type { Array1, Array2, Array3 } from '../../types/array/module.f.ts';
export type ByteOrEof = U8 | null;
export type Utf8NonEmptyState = Array1<number> | Array2<number> | Array3<number>;
export type Utf8State = null | Utf8NonEmptyState;
export type U8 = number;
export type I32 = number;
export declare const fromCodePointList: (input: List<number>) => Thunk<U8>;
export declare const toCodePointList: (input: List<U8>) => List<I32>;
import { flatMap, flat, stateScan } from "../../types/list/module.f.js";
import * as operator from "../../types/function/operator/module.f.js";
import * as Array from "../../types/array/module.f.js";
const errorMask = 0b1000_0000_0000_0000_0000_0000_0000_0000;
const codePointToUtf8 = input => {
const codePointToUtf8 = (input) => {
if (input >= 0x0000 && input <= 0x007f) {

@@ -35,3 +33,3 @@ return [input & 0b01111_1111];

export const fromCodePointList = flatMap(codePointToUtf8);
const utf8StateToError = state => {
const utf8StateToError = (state) => {
let x;

@@ -110,5 +108,5 @@ switch (state.length) {

};
const utf8EofToCodePointOp = state => [state === null ? null : [utf8StateToError(state)], null];
const utf8EofToCodePointOp = (state) => [state === null ? null : [utf8StateToError(state)], null];
const utf8ByteOrEofToCodePointOp = state => input => input === null ? utf8EofToCodePointOp(state) : utf8ByteToCodePointOp(state)(input);
const eofList = [null];
export const toCodePointList = input => flat(stateScan(utf8ByteOrEofToCodePointOp)(null)(flat([input, eofList])));

@@ -1,6 +0,5 @@

import * as encoding from "./module.f.js";
import { toCodePointList, fromCodePointList } from "./module.f.js";
import * as json from "../../json/module.f.js";
import * as o from "../../types/object/module.f.js";
const { sort } = o;
import * as list from "../../types/list/module.f.js";
import { sort } from "../../types/object/module.f.js";
import { toArray } from "../../types/list/module.f.js";
const stringify = json.stringify(sort);

@@ -10,3 +9,3 @@ export default {

() => {
const result = stringify(list.toArray(encoding.toCodePointList([-1, 256])));
const result = stringify(toArray(toCodePointList([-1, 256])));
if (result !== '[2147483648,2147483648]') {

@@ -17,3 +16,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.toCodePointList([128, 193, 245, 255])));
const result = stringify(toArray(toCodePointList([128, 193, 245, 255])));
if (result !== '[-2147483520,-2147483455,-2147483403,-2147483393]') {

@@ -24,3 +23,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.toCodePointList([0, 1, 127])));
const result = stringify(toArray(toCodePointList([0, 1, 127])));
if (result !== '[0,1,127]') {

@@ -31,3 +30,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.toCodePointList([194, 128, 194, 169, 223, 191])));
const result = stringify(toArray(toCodePointList([194, 128, 194, 169, 223, 191])));
if (result !== '[128,169,2047]') {

@@ -38,3 +37,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.toCodePointList([194, 194, 127, 194, 192, 194])));
const result = stringify(toArray(toCodePointList([194, 194, 127, 194, 192, 194])));
if (result !== '[-2147483454,-2147483454,127,-2147483454,-2147483456,-2147483454]') {

@@ -45,3 +44,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.toCodePointList([224, 160, 128, 224, 160, 129, 239, 191, 191])));
const result = stringify(toArray(toCodePointList([224, 160, 128, 224, 160, 129, 239, 191, 191])));
if (result !== '[2048,2049,65535]') {

@@ -52,3 +51,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.toCodePointList([224, 224, 160, 127, 239, 191])));
const result = stringify(toArray(toCodePointList([224, 224, 160, 127, 239, 191])));
if (result !== '[-2147483424,-2147482592,127,-2147481601]') {

@@ -59,3 +58,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.toCodePointList([240, 144, 128, 128, 240, 144, 128, 129, 244, 143, 191, 191])));
const result = stringify(toArray(toCodePointList([240, 144, 128, 128, 240, 144, 128, 129, 244, 143, 191, 191])));
if (result !== '[65536,65537,1114111]') {

@@ -66,3 +65,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.toCodePointList([240, 240, 160, 127, 244, 191])));
const result = stringify(toArray(toCodePointList([240, 240, 160, 127, 244, 191])));
if (result !== '[-2147483408,-2147483104,127,-2147482817]') {

@@ -73,3 +72,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.toCodePointList([240, 160, 160, 244, 160, 160])));
const result = stringify(toArray(toCodePointList([240, 160, 160, 244, 160, 160])));
if (result !== '[-2147448800,-2147432416]') {

@@ -82,3 +81,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([0, 1, 0x7F])));
const result = stringify(toArray(fromCodePointList([0, 1, 0x7F])));
if (result !== '[0,1,127]') {

@@ -89,3 +88,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([0x80])));
const result = stringify(toArray(fromCodePointList([0x80])));
if (result !== '[194,128]') {

@@ -96,3 +95,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([0xa9])));
const result = stringify(toArray(fromCodePointList([0xa9])));
if (result !== '[194,169]') {

@@ -103,3 +102,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([0x7ff])));
const result = stringify(toArray(fromCodePointList([0x7ff])));
if (result !== '[223,191]') {

@@ -110,3 +109,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([0x800])));
const result = stringify(toArray(fromCodePointList([0x800])));
if (result !== '[224,160,128]') {

@@ -117,3 +116,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([0x801])));
const result = stringify(toArray(fromCodePointList([0x801])));
if (result !== '[224,160,129]') {

@@ -124,3 +123,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([0xffff])));
const result = stringify(toArray(fromCodePointList([0xffff])));
if (result !== '[239,191,191]') {

@@ -131,3 +130,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([0x10000])));
const result = stringify(toArray(fromCodePointList([0x10000])));
if (result !== '[240,144,128,128]') {

@@ -138,3 +137,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([0x10001])));
const result = stringify(toArray(fromCodePointList([0x10001])));
if (result !== '[240,144,128,129]') {

@@ -145,3 +144,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([0x10FFFF])));
const result = stringify(toArray(fromCodePointList([0x10FFFF])));
if (result !== '[244,143,191,191]') {

@@ -152,3 +151,3 @@ throw result;

() => {
const result = stringify(list.toArray(encoding.fromCodePointList([0x110000, 2147483648])));
const result = stringify(toArray(fromCodePointList([0x110000, 2147483648])));
if (result !== '[2147483648,2147483648]') {

@@ -161,4 +160,4 @@ throw result;

() => {
const codePointList = encoding.toCodePointList([128, 193, 245, 255]);
const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)));
const codePointList = toCodePointList([128, 193, 245, 255]);
const result = stringify(toArray(fromCodePointList(codePointList)));
if (result !== '[128,193,245,255]') {

@@ -169,4 +168,4 @@ throw result;

() => {
const codePointList = encoding.toCodePointList([194, 194, 127, 194, 192, 194]);
const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)));
const codePointList = toCodePointList([194, 194, 127, 194, 192, 194]);
const result = stringify(toArray(fromCodePointList(codePointList)));
if (result !== '[194,194,127,194,192,194]') {

@@ -177,4 +176,4 @@ throw result;

() => {
const codePointList = encoding.toCodePointList([224, 224, 160, 127, 239, 191]);
const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)));
const codePointList = toCodePointList([224, 224, 160, 127, 239, 191]);
const result = stringify(toArray(fromCodePointList(codePointList)));
if (result !== '[224,224,160,127,239,191]') {

@@ -185,4 +184,4 @@ throw result;

() => {
const codePointList = encoding.toCodePointList([240, 240, 160, 127, 244, 191]);
const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)));
const codePointList = toCodePointList([240, 240, 160, 127, 244, 191]);
const result = stringify(toArray(fromCodePointList(codePointList)));
if (result !== '[240,240,160,127,244,191]') {

@@ -193,4 +192,4 @@ throw result;

() => {
const codePointList = encoding.toCodePointList([240, 160, 160, 244, 160, 160]);
const result = stringify(list.toArray(encoding.fromCodePointList(codePointList)));
const codePointList = toCodePointList([240, 160, 160, 244, 160, 160]);
const result = stringify(toArray(fromCodePointList(codePointList)));
if (result !== '[240,160,160,244,160,160]') {

@@ -197,0 +196,0 @@ throw result;

@@ -49,3 +49,3 @@ import { abs, sign } from "../bigint/module.f.js";

};
export const decToBin = dec => {
export const decToBin = (dec) => {
if (dec[0] === 0n) {

@@ -52,0 +52,0 @@ return [0n, 0];

import * as compare from '../function/compare/module.f.ts';
import type * as Operator from '../function/operator/module.f.ts';
import { type List } from '../list/module.f.ts';
type Unary = Operator.Unary<bigint, bigint>;
type Reduce = Operator.Reduce<bigint>;
export type Unary = Operator.Unary<bigint, bigint>;
export type Reduce = Operator.Reduce<bigint>;
export declare const addition: Reduce;

@@ -47,6 +47,18 @@ export declare const sum: (input: List<bigint>) => bigint;

* @remark
* The function uses the `log2` function to calculate the position of the most significant bit(MSB)
* and adds `1n` to account for the MSB itself.For negative numbers, the absolute value is used.
* The function uses the `log2` function to calculate the position of the most significant bit (MSB)
* and adds `1n` to account for the MSB itself. For negative numbers, the absolute value is used.
*/
export declare const bitLength: (v: bigint) => bigint;
export {};
/**
* Generates a bitmask with the specified number of bits set to 1.
*
* @param len - The number of bits to set in the mask. Must be a non-negative integer.
* @returns A bigint representing the bitmask, where the least significant `len` bits are 1.
*
* @example
*
* ```js
* const result = mask(3n) // 7n
* ```
*/
export declare const mask: (len: bigint) => bigint;

@@ -7,4 +7,4 @@ import * as compare from "../function/compare/module.f.js";

export const abs = a => a >= 0 ? a : -a;
export const sign = a => unsafeCmp(a)(0n);
export const serialize = a => `${a}n`;
export const sign = (a) => unsafeCmp(a)(0n);
export const serialize = (a) => `${a}n`;
/**

@@ -29,2 +29,4 @@ * Calculates the base-2 logarithm (floor).

export const log2 = (v) => {
// TODO: use step 32 and `Math.clz32()` at the end.
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32
if (v <= 0n) {

@@ -74,4 +76,4 @@ return -1n;

* @remark
* The function uses the `log2` function to calculate the position of the most significant bit(MSB)
* and adds `1n` to account for the MSB itself.For negative numbers, the absolute value is used.
* The function uses the `log2` function to calculate the position of the most significant bit (MSB)
* and adds `1n` to account for the MSB itself. For negative numbers, the absolute value is used.
*/

@@ -87,1 +89,14 @@ export const bitLength = (v) => {

};
/**
* Generates a bitmask with the specified number of bits set to 1.
*
* @param len - The number of bits to set in the mask. Must be a non-negative integer.
* @returns A bigint representing the bitmask, where the least significant `len` bits are 1.
*
* @example
*
* ```js
* const result = mask(3n) // 7n
* ```
*/
export const mask = (len) => (1n << len) - 1n;
declare const _default: {
mask: () => void;
sum: () => void;

@@ -3,0 +4,0 @@ abs: (() => void)[];

@@ -1,4 +0,9 @@

import * as _ from "./module.f.js";
const { sum, abs, serialize, log2, bitLength } = _;
import { sum, abs, serialize, log2, bitLength, mask } from "./module.f.js";
export default {
mask: () => {
const result = mask(3n); // 7n
if (result !== 7n) {
throw result;
}
},
sum: () => {

@@ -5,0 +10,0 @@ const result = sum([2n, 3n, 4n, 5n]);

@@ -0,5 +1,6 @@

import { type List, type Thunk } from '../list/module.f.ts';
/**
* A vector of bits represented as a `bigint`.
*/
type Vec = bigint;
export type Vec = bigint;
/**

@@ -26,2 +27,6 @@ * An empty vector of bits.

/**
* Creates an 8 bit vector from an unsigned integer.
*/
export declare const vec8: (u: bigint) => Vec;
/**
* Returns the unsigned integer of the given vector by removing a stop bit.

@@ -38,99 +43,114 @@ *

/**
* Extract the least significant unsigned integer from the given vector.
* Represents operations for handling bit vectors with a specific bit order.
*
* @example
*
* ```js
* const vector = vec(8n)(0xF5n) // 0x1F5n
* const result = uintLsb(4n)(vector); // result is 5n
* const result2 = uintLsb(16n)(vector); // result2 is 0xF5n
* ```
* https://en.wikipedia.org/wiki/Bit_numbering
*/
export declare const uintLsb: (len: bigint) => (v: Vec) => bigint;
export type BitOrder = {
/**
* Retrieves the first unsigned integer of the specified length from the given vector.
*
* @param len - The number of bits to read from the start of the vector.
* @returns A function that takes a vector and returns the extracted unsigned integer.
*
* @example
*
* ```js
* const vector = vec(8n)(0xF5n) // 0x1F5n
*
* const resultL0 = lsb.front(4n)(vector) // resultL0 is 5n
* const resultL1 = lsb.front(16n)(vector) // resultL1 is 0xF5n
*
* const resultM0 = msb.front(4n)(vector) // resultM0 is 0xFn
* const resultM1 = msb.front(16n)(vector) // resultM1 is 0xF500n
* ```
*/
readonly front: (len: bigint) => (v: Vec) => bigint;
/**
* Removes a specified number of bits from the start of the given vector.
*
* @param len - The number of bits to remove from the vector.
* @returns A function that takes a vector and returns the remaining vector.
*
* @example
*
* ```js
* const v = vec(16n)(0x3456n) // 0x13456n
*
* const rL0 = lsb.removeFront(4n)(v) // 0x1345n
* const rL1 = lsb.removeFront(24n)(v) // 0x1n
*
* const rM0 = msb.removeFront(4n)(v) // 0x1456n
* const rM1 = msb.removeFront(24n)(v) // 0x1n
* ```
*/
readonly removeFront: (len: bigint) => (v: Vec) => Vec;
/**
* Removes a specified number of bits from the start of the vector and returns
* the removed bits and the remaining vector.
*
* @param len - The number of bits to remove from the vector.
* @returns A function that takes a vector and returns
* a tuple containing the removed bits as an unsigned integer and the remaining vector.
*
* ```js
* const vector = vec(8n)(0xF5n) // 0x1F5n
*
* const [uL0, rL0] = lsb.popFront(4n)(vector) // [5n, 0x1Fn]
* const [uL1, rL1] = lsb.popFront(16n)(vector) // [0xF5n, 1n]
*
* const [uM0, rM0] = msb.popFront(4n)(vector) // [0xFn, 0x15n]
* const [uM1, rM1] = msb.popFront(16n)(vector) // [0xF500n, 1n]
* ```
*/
readonly popFront: (len: bigint) => (v: Vec) => readonly [bigint, Vec];
/**
* Concatenates two vectors.
*
* @param a - The first vector.
* @returns A function that takes a second vector and returns the concatenated vector.
*
* @example
*
* ```js
* const u8 = vec(8n)
* const a = u8(0x45n) // 0x145n
* const b = u8(0x89n) // 0x189n
*
* const abL = lsb.concat(a)(b) // 0x18945n
* const abM = msb.concat(a)(b) // 0x14589n
* ```
*/
readonly concat: (a: Vec) => (b: Vec) => Vec;
};
/**
* Removes the first `len` least significant bits from the given vector.
* Implements operations for handling vectors in a least-significant-bit (LSb) first order.
*
* @example
* https://en.wikipedia.org/wiki/Bit_numbering#LSb_0_bit_numbering
*
* ```js
* const v = vec(16n)(0x3456n) // 0x13456n
* const r = removeLsb(4n)(v) // 0x1345n
* const r2 = removeLsb(24n)(v) // 0x1n
* ```
* Usually associated with Little-Endian (LE) byte order.
*/
export declare const removeLsb: (len: bigint) => (v: Vec) => Vec;
export declare const lsb: BitOrder;
/**
* Extracts the least significant unsigned integer and removes it from the vector.
* Implements operations for handling vectors in a most-significant-bit (MSb) first order.
*
* @example
* https://en.wikipedia.org/wiki/Bit_numbering#MSb_0_bit_numbering
*
* ```js
* const vector = vec(8n)(0xF5n) // 0x1F5n
* const [result, rest] = popUintLsb(4n)(vector); // result is 5n, rest is 0x1Fn
* const [result2, rest2] = popUintLsb(16n)(vector); // result2 is 0xF5n, rest2 is 1n
* ```
* Usually associated with Big-Endian (BE) byte order.
*/
export declare const popUintLsb: (len: bigint) => (v: Vec) => readonly [bigint, Vec];
export declare const msb: BitOrder;
/**
* Extract the most significant unsigned integer of the given `len` from the given vector.
* Converts a list of unsigned 8-bit integers to a bit vector.
*
* @example
*
* ```js
* const vector = vec(8n)(0xF5n) // 0x1F5n
* const result = uintMsb(4n)(vector); // result is 0xFn
* const result2 = uintMsb(16n)(vector); // result2 is 0xF500n
* ```
* @param bo The bit order for the conversion
* @param list The list of unsigned 8-bit integers to be converted.
* @returns The resulting vector based on the provided bit order.
*/
export declare const uintMsb: (len: bigint) => (v: Vec) => bigint;
export declare const u8ListToVec: (bo: BitOrder) => (list: List<number>) => Vec;
/**
* Removes the first `len` most significant bits from the given vector.
* Converts a bit vector to a list of unsigned 8-bit integers based on the provided bit order.
*
* @example
*
* ```js
* const v = vec(16n)(0x3456n) // 0x13456n
* const r = removeMsb(4n)(v) // 0x1456n
* const r2 = removeMsb(24n)(v) // 0x1n
* ```
* @param bitOrder The bit order for the conversion.
* @param v The vector to be converted.
* @returns A thunk that produces a list of unsigned 8-bit integers.
*/
export declare const removeMsb: (len: bigint) => (v: Vec) => Vec;
/**
* Extracts the most significant unsigned integer and removes it from the vector.
*
* @example
*
* ```js
* const vector = vec(8n)(0xF5n) // 0x1F5n
* const [result, rest] = popUintMsb(4n)(vector); // [0xFn, 0x15n]
* const [result2, rest2] = popUintMsb(16n)(vector); // [0xF500n, 1n]
* ```
*/
export declare const popUintMsb: (len: bigint) => (v: Vec) => readonly [bigint, Vec];
/**
* Concat the given vectors of bits. The first vector is the least significant.
*
* @example
*
* ```js
* const u8 = vec(8n)
* const a = u8(0x45n) // 0x145n
* const b = u8(0x89n) // 0x189n
* const ab = concatLsb(a)(b) // 0x18945n
* ```
*/
export declare const concatLsb: (a: Vec) => (b: Vec) => Vec;
/**
* Concat the given vectors of bits. The first vector is the most significant.
*
* @example
*
* ```js
* const u8 = vec(8n)
* const a = u8(0x45n) // 0x145n
* const b = u8(0x89n) // 0x189n
* const ab = concatMsb(a)(b) // 0x14589n
* ```
*/
export declare const concatMsb: (b: Vec) => (a: Vec) => Vec;
export {};
export declare const u8List: ({ popFront }: BitOrder) => (v: Vec) => Thunk<number>;

@@ -1,3 +0,4 @@

import { log2 } from "../bigint/module.f.js";
import { log2, mask } from "../bigint/module.f.js";
import { flip } from "../function/module.f.js";
import { fold } from "../list/module.f.js";
/**

@@ -30,4 +31,7 @@ * An empty vector of bits.

};
const mask = (len) => (1n << len) - 1n;
/**
* Creates an 8 bit vector from an unsigned integer.
*/
export const vec8 = vec(8n);
/**
* Returns the unsigned integer of the given vector by removing a stop bit.

@@ -44,126 +48,80 @@ *

/**
* Extract the least significant unsigned integer from the given vector.
* Implements operations for handling vectors in a least-significant-bit (LSb) first order.
*
* @example
* https://en.wikipedia.org/wiki/Bit_numbering#LSb_0_bit_numbering
*
* ```js
* const vector = vec(8n)(0xF5n) // 0x1F5n
* const result = uintLsb(4n)(vector); // result is 5n
* const result2 = uintLsb(16n)(vector); // result2 is 0xF5n
* ```
* Usually associated with Little-Endian (LE) byte order.
*/
export const uintLsb = (len) => {
const m = mask(len);
return v => {
const result = v & m;
return result === v ? uint(v) : result;
};
export const lsb = {
front: len => {
const m = mask(len);
return v => {
const result = v & m;
return result === v ? uint(v) : result;
};
},
removeFront: len => v => {
const r = v >> len;
return r === 0n ? empty : r;
},
popFront: len => {
const m = mask(len);
return v => {
const result = v & m;
return result === v ? [uint(v), empty] : [result, v >> len];
};
},
concat: a => {
const aLen = length(a);
const m = mask(aLen);
return b => (b << aLen) | (a & m);
}
};
/**
* Removes the first `len` least significant bits from the given vector.
* Implements operations for handling vectors in a most-significant-bit (MSb) first order.
*
* @example
* https://en.wikipedia.org/wiki/Bit_numbering#MSb_0_bit_numbering
*
* ```js
* const v = vec(16n)(0x3456n) // 0x13456n
* const r = removeLsb(4n)(v) // 0x1345n
* const r2 = removeLsb(24n)(v) // 0x1n
* ```
* Usually associated with Big-Endian (BE) byte order.
*/
export const removeLsb = (len) => (v) => {
const r = v >> len;
return r === 0n ? empty : r;
export const msb = {
front: len => {
const m = mask(len);
return v => (v >> (length(v) - len)) & m;
},
removeFront: len => v => vec(length(v) - len)(v),
popFront: len => {
const m = mask(len);
return v => {
const d = length(v) - len;
return [(v >> d) & m, vec(d)(v)];
};
},
concat: flip(lsb.concat)
};
const appendU8 = ({ concat }) => (u8) => (a) => concat(a)(vec8(BigInt(u8)));
/**
* Extracts the least significant unsigned integer and removes it from the vector.
* Converts a list of unsigned 8-bit integers to a bit vector.
*
* @example
*
* ```js
* const vector = vec(8n)(0xF5n) // 0x1F5n
* const [result, rest] = popUintLsb(4n)(vector); // result is 5n, rest is 0x1Fn
* const [result2, rest2] = popUintLsb(16n)(vector); // result2 is 0xF5n, rest2 is 1n
* ```
* @param bo The bit order for the conversion
* @param list The list of unsigned 8-bit integers to be converted.
* @returns The resulting vector based on the provided bit order.
*/
export const popUintLsb = (len) => {
const m = mask(len);
return v => {
const result = v & m;
return result === v ? [uint(v), empty] : [result, v >> len];
};
};
export const u8ListToVec = (bo) => fold(appendU8(bo))(empty);
/**
* Extract the most significant unsigned integer of the given `len` from the given vector.
* Converts a bit vector to a list of unsigned 8-bit integers based on the provided bit order.
*
* @example
*
* ```js
* const vector = vec(8n)(0xF5n) // 0x1F5n
* const result = uintMsb(4n)(vector); // result is 0xFn
* const result2 = uintMsb(16n)(vector); // result2 is 0xF500n
* ```
* @param bitOrder The bit order for the conversion.
* @param v The vector to be converted.
* @returns A thunk that produces a list of unsigned 8-bit integers.
*/
export const uintMsb = (len) => {
const m = mask(len);
return v => (v >> (length(v) - len)) & m;
};
/**
* Removes the first `len` most significant bits from the given vector.
*
* @example
*
* ```js
* const v = vec(16n)(0x3456n) // 0x13456n
* const r = removeMsb(4n)(v) // 0x1456n
* const r2 = removeMsb(24n)(v) // 0x1n
* ```
*/
export const removeMsb = (len) => (v) => vec(length(v) - len)(v);
/**
* Extracts the most significant unsigned integer and removes it from the vector.
*
* @example
*
* ```js
* const vector = vec(8n)(0xF5n) // 0x1F5n
* const [result, rest] = popUintMsb(4n)(vector); // [0xFn, 0x15n]
* const [result2, rest2] = popUintMsb(16n)(vector); // [0xF500n, 1n]
* ```
*/
export const popUintMsb = (len) => {
const m = mask(len);
return v => {
const d = length(v) - len;
return [(v >> d) & m, vec(d)(v)];
export const u8List = ({ popFront }) => {
const f = (v) => () => {
if (v === empty) {
return null;
}
const [first, tail] = popFront(8n)(v);
return { first: Number(first), tail: f(tail) };
};
return f;
};
/**
* Concat the given vectors of bits. The first vector is the least significant.
*
* @example
*
* ```js
* const u8 = vec(8n)
* const a = u8(0x45n) // 0x145n
* const b = u8(0x89n) // 0x189n
* const ab = concatLsb(a)(b) // 0x18945n
* ```
*/
export const concatLsb = (a) => {
const aLen = length(a);
const m = mask(aLen);
return b => (b << aLen) | (a & m);
};
/**
* Concat the given vectors of bits. The first vector is the most significant.
*
* @example
*
* ```js
* const u8 = vec(8n)
* const a = u8(0x45n) // 0x145n
* const b = u8(0x89n) // 0x189n
* const ab = concatMsb(a)(b) // 0x14589n
* ```
*/
export const concatMsb = flip(concatLsb);

@@ -5,11 +5,23 @@ declare const _default: {

uint: () => void;
uintLsb: () => void;
uintMsb: () => void;
popUintLsb: () => void;
popUintMsb: () => void;
concatLsb: () => void;
concatMsb: () => void;
removeLsb: () => void;
removeMsb: () => void;
front: () => void;
removeFront: () => void;
popFront: () => void;
concat: () => void;
};
front: {
lsbf: () => void;
msbf: () => void;
};
popFront: {
lsbm: () => void;
msbm: () => void;
};
removeFront: {
lsbm: () => void;
msbm: () => void;
};
concat: {
lsbm: () => void;
msbm: () => void;
};
uintLsb: () => void;

@@ -16,0 +28,0 @@ uintSmall: () => void;

@@ -1,2 +0,71 @@

import { empty, vec, length, concatLsb, uintLsb, uintMsb, removeLsb, concatMsb, removeMsb, uint, popUintLsb, popUintMsb } from "./module.f.js";
import { empty, vec, length, uint, lsb, msb } from "./module.f.js";
const frontTest = (e) => (r0) => (r1) => () => {
const vector = vec(8n)(0xf5n); // 0x1F5n
if (vector !== 0x1f5n) {
throw vector;
}
const result = e.front(4n)(vector);
if (result !== r0) {
throw result;
}
const result2 = e.front(16n)(vector);
if (result2 !== r1) {
throw result2;
}
};
const popFront = (e) => ([r00, r01]) => ([r10, r11]) => () => {
const vector = vec(8n)(0xf5n); // 0x1F5n
const [result, rest] = e.popFront(4n)(vector);
if (result !== r00) {
throw result;
}
if (rest !== r01) {
throw rest;
}
const [result2, rest2] = e.popFront(16n)(vector);
if (result2 !== r10) {
throw result2;
}
if (rest2 !== r11) {
throw rest2;
}
};
const removeFront = (e) => (r0) => (r1) => () => {
const v = vec(16n)(0x3456n); // 0x13456n
if (v !== 0x13456n) {
throw v;
}
const r = e.removeFront(4n)(v);
if (r !== r0) {
throw r;
}
const r2 = e.removeFront(24n)(v);
if (r2 !== r1) {
throw r2;
}
};
const concat = (e) => (r) => () => {
const u8 = vec(8n);
const a = u8(0x45n); // 0x145n
if (a !== 0x145n) {
throw a;
}
const b = u8(0x89n); // 0x189n
if (b !== 0x189n) {
throw b;
}
const ab = e.concat(a)(b); // 0x18945n
if (ab !== r) {
throw ab;
}
};
const assertEq = (a, b) => {
if (a !== b) {
throw [a, b];
}
};
const assertEq2 = ([a0, a1], [b0, b1]) => {
assertEq(a0, b0);
assertEq(a1, b1);
};
export default {

@@ -25,126 +94,50 @@ examples: {

},
uintLsb: () => {
front: () => {
const vector = vec(8n)(0xf5n); // 0x1F5n
if (vector !== 0x1f5n) {
throw vector;
}
const result = uintLsb(4n)(vector); // result is 5n
if (result !== 5n) {
throw result;
}
const result2 = uintLsb(16n)(vector); // result2 is 0xF5n
if (result2 !== 0xf5n) {
throw result2;
}
assertEq(lsb.front(4n)(vector), 5n);
assertEq(lsb.front(16n)(vector), 0xf5n);
assertEq(msb.front(4n)(vector), 0xfn);
assertEq(msb.front(16n)(vector), 0xf500n);
},
uintMsb: () => {
const vector = vec(8n)(0xf5n); // 0x1F5n
if (vector !== 0x1f5n) {
throw vector;
}
const result = uintMsb(4n)(vector); // result is 0xFn
if (result !== 0xfn) {
throw result;
}
const result2 = uintMsb(16n)(vector); // result2 is 0xF500n
if (result2 !== 0xf500n) {
throw result2;
}
removeFront: () => {
const v = vec(16n)(0x3456n); // 0x13456n
assertEq(lsb.removeFront(4n)(v), 0x1345n);
assertEq(lsb.removeFront(24n)(v), 0x1n);
assertEq(msb.removeFront(4n)(v), 0x1456n);
assertEq(msb.removeFront(24n)(v), 0x1n);
},
popUintLsb: () => {
popFront: () => {
const vector = vec(8n)(0xf5n); // 0x1F5n
const [result, rest] = popUintLsb(4n)(vector); // result is 5n, rest is 0x1Fn
if (result !== 5n) {
throw result;
}
if (rest !== 0x1fn) {
throw rest;
}
const [result2, rest2] = popUintLsb(16n)(vector); // result2 is 0xF5n, rest2 is 1n
if (result2 !== 0xf5n) {
throw result2;
}
if (rest2 !== 1n) {
throw rest2;
}
assertEq2(lsb.popFront(4n)(vector), [5n, 0x1fn]);
assertEq2(lsb.popFront(16n)(vector), [0xf5n, 1n]);
assertEq2(msb.popFront(4n)(vector), [0xfn, 0x15n]);
assertEq2(msb.popFront(16n)(vector), [0xf500n, 1n]);
},
popUintMsb: () => {
const vector = vec(8n)(0xf5n); // 0x1F5n
const [result, rest] = popUintMsb(4n)(vector); // [0xFn, 0x15n]
if (result !== 0xfn) {
throw result;
}
if (rest !== 0x15n) {
throw rest;
}
const [result2, rest2] = popUintMsb(16n)(vector); // [0xF500n, 1n]
if (result2 !== 0xf500n) {
throw result2;
}
if (rest2 !== 1n) {
throw rest2;
}
},
concatLsb: () => {
concat: () => {
const u8 = vec(8n);
const a = u8(0x45n); // 0x145n
if (a !== 0x145n) {
throw a;
}
const b = u8(0x89n); // 0x189n
if (b !== 0x189n) {
throw b;
}
const ab = concatLsb(a)(b); // 0x18945n
if (ab !== 0x18945n) {
throw ab;
}
},
concatMsb: () => {
const u8 = vec(8n);
const a = u8(0x45n); // 0x145n
if (a !== 0x145n) {
throw a;
}
const b = u8(0x89n); // 0x189n
if (b !== 0x189n) {
throw b;
}
const ab = concatMsb(a)(b); // 0x14589n
if (ab !== 0x14589n) {
throw ab;
}
},
removeLsb: () => {
const v = vec(16n)(0x3456n); // 0x13456n
if (v !== 0x13456n) {
throw v;
}
const r = removeLsb(4n)(v); // 0x1345n
if (r !== 0x1345n) {
throw r;
}
const r2 = removeLsb(24n)(v); // 0x1n
if (r2 !== 0x1n) {
throw r2;
}
},
removeMsb: () => {
const v = vec(16n)(0x3456n); // 0x13456n
if (v !== 0x13456n) {
throw v;
}
const r = removeMsb(4n)(v); // 0x1456n
if (r !== 0x1456n) {
throw r;
}
const r2 = removeMsb(24n)(v); // 0x1n
if (r2 !== 0x1n) {
throw r2;
}
assertEq(lsb.concat(a)(b), 0x18945n);
assertEq(msb.concat(a)(b), 0x14589n);
}
},
front: {
lsbf: frontTest(lsb)(5n)(0xf5n),
msbf: frontTest(msb)(0xfn)(0xf500n),
},
popFront: {
lsbm: popFront(lsb)([5n, 0x1fn])([0xf5n, 1n]),
msbm: popFront(msb)([0xfn, 0x15n])([0xf500n, 1n]),
},
removeFront: {
lsbm: removeFront(lsb)(0x1345n)(0x1n),
msbm: removeFront(msb)(0x1456n)(0x1n),
},
concat: {
lsbm: concat(lsb)(0x18945n),
msbm: concat(msb)(0x14589n),
},
uintLsb: () => {
const vector = 117n;
const extract3Bits = uintLsb(3n);
const extract3Bits = lsb.front(3n);
const result = extract3Bits(vector); // result is 0b101n (5n)

@@ -157,3 +150,3 @@ if (result !== 5n) {

const vector = 3n;
const extract3Bits = uintLsb(3n)(vector);
const extract3Bits = lsb.front(3n)(vector);
if (extract3Bits !== 1n) {

@@ -184,3 +177,3 @@ throw extract3Bits;

}
const u = uintLsb(8n)(v);
const u = lsb.front(8n)(v);
if (u !== 0xfen) {

@@ -194,3 +187,3 @@ throw v;

const b = vec8(0x789n);
const ab = concatLsb(a)(b);
const ab = lsb.concat(a)(b);
if (ab !== 0x18945n) {

@@ -209,3 +202,3 @@ throw ab;

}
const r = removeLsb(9n)(v);
const r = lsb.removeFront(9n)(v);
if (r !== 0x191n) {

@@ -212,0 +205,0 @@ throw r.toString(16);

import * as _ from "./module.f.js";
import * as list from "../../list/module.f.js";
import * as json from "../../../json/module.f.js";
import * as o from "../../object/module.f.js";
const { sort } = o;
import * as btree from "../types/module.f.js";
import { sort } from "../../object/module.f.js";
import * as string from "../../string/module.f.js";

@@ -16,4 +14,5 @@ const { cmp } = string;

let _map = ['1'];
for (let i = 2; i <= 10; i++)
for (let i = 2; i <= 10; i++) {
_map = set(_map)((i * i).toString());
}
{

@@ -20,0 +19,0 @@ const s = jsonStr(_map);

@@ -1,4 +0,4 @@

import * as list from '../list/module.f.ts';
import * as _ from './types/module.f.ts';
import { type List } from '../list/module.f.ts';
import type * as _ from './types/module.f.ts';
export declare const empty: null;
export declare const values: <T>(tree: _.Tree<T>) => list.List<T>;
export declare const values: <T>(tree: _.Tree<T>) => List<T>;

@@ -1,6 +0,3 @@

import * as list from "../list/module.f.js";
const { flat } = list;
import * as n from "../nullable/module.f.js";
const { map } = n;
import * as _ from "./types/module.f.js";
import { flat } from "../list/module.f.js";
import { map } from "../nullable/module.f.js";
const nodeValues = node => () => {

@@ -7,0 +4,0 @@ switch (node.length) {

import * as _ from "./module.f.js";
import * as BTree from "../types/module.f.js";
import * as s from "../set/module.f.js";

@@ -9,4 +8,4 @@ import * as str from "../../string/module.f.js";

const { sort } = o;
const set = node => value => s.set(cmp(value))(() => value)(node);
const remove = node => value => _.nodeRemove(cmp(value))(node);
const set = (node) => (value) => s.set(cmp(value))(() => value)(node);
const remove = (node) => (value) => _.nodeRemove(cmp(value))(node);
const jsonStr = json.stringify(sort);

@@ -13,0 +12,0 @@ const test = () => {

import * as _ from "./module.f.js";
import * as BTree from "../types/module.f.js";
import * as s from "../../string/module.f.js";
const { cmp } = s;
import { cmp } from "../../string/module.f.js";
import * as json from "../../../json/module.f.js";
import * as o from "../../object/module.f.js";
const { sort } = o;
const set = node => value => _.set(cmp(value))(() => value)(node);
import { sort } from "../../object/module.f.js";
const set = (node) => (value) => _.set(cmp(value))(() => value)(node);
const jsonStr = json.stringify(sort);

@@ -10,0 +7,0 @@ const test = [

@@ -1,2 +0,1 @@

import * as BTree from "./types/module.f.js";
import * as _ from "./module.f.js";

@@ -3,0 +2,0 @@ const { values } = _;

@@ -1,3 +0,4 @@

type Array1<T> = readonly [T];
type Array2<T> = readonly [T, T];
export type Array1<T> = readonly [T];
export type Array2<T> = readonly [T, T];
export type Array3<T> = readonly [T, T, T];
export type Leaf1<T> = Array1<T>;

@@ -11,2 +12,1 @@ export type Leaf2<T> = Array2<T>;

export type Branch7<T> = readonly [...Branch5<T>, T, TNode<T>];
export {};

@@ -1,3 +0,3 @@

import * as RangeMap from '../range_map/module.f.ts';
import * as SortedSet from '../sorted_set/module.f.ts';
import type * as RangeMap from '../range_map/module.f.ts';
import type * as SortedSet from '../sorted_set/module.f.ts';
export type ByteSet = bigint;

@@ -4,0 +4,0 @@ type Byte = number;

import { compose } from "../function/module.f.js";
import * as RangeMap from "../range_map/module.f.js";
import * as SortedSet from "../sorted_set/module.f.js";
import * as list from "../list/module.f.js";

@@ -5,0 +3,0 @@ const { reverse, countdown, flat, map } = list;

@@ -1,2 +0,2 @@

import * as Array from '../../array/module.f.ts';
import type * as Array from '../../array/module.f.ts';
export type Index3 = Array.Index3;

@@ -3,0 +3,0 @@ export type Index5 = Array.Index5;

@@ -1,2 +0,1 @@

import * as Array from "../../array/module.f.js";
export const index3 = cmp => value => (cmp(value) + 1);

@@ -3,0 +2,0 @@ export const index5 = cmp => ([v0, v1]) => {

@@ -1,3 +0,2 @@

import * as _ from "./module.f.js";
const { unsafeCmp } = _;
import { unsafeCmp } from "./module.f.js";
export default () => {

@@ -4,0 +3,0 @@ const result = unsafeCmp(true)(false);

@@ -27,3 +27,3 @@ /**

*/
export declare const fn: <I, O>(f: (i: I) => O) => Fn<I, O>;
export declare const fn: <I, O>(result: Func<I, O>) => Fn<I, O>;
export {};

@@ -16,5 +16,5 @@ /**

*/
export const fn = result => ({
export const fn = (result) => ({
result,
then: g => fn(compose(result)(g))
});

@@ -1,2 +0,2 @@

type Binary<A, B, R> = (a: A) => (b: B) => R;
export type Binary<A, B, R> = (a: A) => (b: B) => R;
export type Fold<I, O> = Binary<I, O, O>;

@@ -14,3 +14,3 @@ export declare const join: (separator: string) => Reduce<string>;

export type Reduce<T> = Fold<T, T>;
export declare const reduceToScan: <T>(fold: Reduce<T>) => Scan<T, T>;
export declare const reduceToScan: <T>(op: Reduce<T>) => Scan<T, T>;
export declare const addition: Reduce<number>;

@@ -21,2 +21,1 @@ export declare const min: Reduce<number>;

export declare const counter: () => (b: number) => number;
export {};

@@ -1,14 +0,14 @@

export const join = separator => value => prior => `${prior}${separator}${value}`;
export const join = (separator) => value => prior => `${prior}${separator}${value}`;
export const concat = i => acc => `${acc}${i}`;
export const logicalNot = v => !v;
export const strictEqual = a => b => a === b;
export const stateScanToScan = op => prior => i => {
export const strictEqual = (a) => (b) => a === b;
export const stateScanToScan = (op) => (prior) => i => {
const [o, s] = op(prior)(i);
return [o, stateScanToScan(op)(s)];
};
export const foldToScan = fold => prior => i => {
export const foldToScan = (fold) => (prior) => i => {
const result = fold(i)(prior);
return [result, foldToScan(fold)(result)];
};
export const reduceToScan = op => init => [init, foldToScan(op)(init)];
export const reduceToScan = (op) => init => [init, foldToScan(op)(init)];
export const addition = a => b => a + b;

@@ -15,0 +15,0 @@ export const min = a => b => a < b ? a : b;

@@ -1,3 +0,2 @@

import * as _ from "./module.f.js";
const { fn } = _;
import { fn } from "./module.f.js";
export default () => {

@@ -4,0 +3,0 @@ const f = x => [x];

@@ -16,3 +16,3 @@ import { type Scan, type StateScan, type Fold, type Reduce, type Equal } from '../function/operator/module.f.ts';

export declare const concat: <T>(head: List<T>) => (tail: List<T>) => List<T>;
export declare const next: <T>(list: List<T>) => Result<T>;
export declare const next: <T>(head: List<T>) => Result<T>;
export declare const iterable: <T>(list: List<T>) => Iterable<T>;

@@ -19,0 +19,0 @@ export declare const toArray: <T>(list: List<T>) => readonly T[];

import { identity, fn, compose } from "../function/module.f.js";
import { addition, logicalNot, strictEqual, stateScanToScan, foldToScan, reduceToScan, } from "../function/operator/module.f.js";
const fromArray = array => {
const at = i => i < array.length ? { first: array[i], tail: () => at(i + 1) } : null;
const fromArray = (array) => {
const at = (i) => i < array.length ? { first: array[i], tail: () => at(i + 1) } : null;
return at(0);
};
export const concat = head => tail => tail === null ? head : ({ head, tail });
const trampoline = list => {
export const concat = (head) => (tail) => tail === null ? head : ({ head, tail });
const trampoline = (list) => {
while (typeof list === 'function') {

@@ -14,3 +14,3 @@ list = list();

};
export const next = head => {
export const next = (head) => {
let tail = null;

@@ -35,3 +35,3 @@ while (true) {

};
export const iterable = list => ({
export const iterable = (list) => ({
*[Symbol.iterator]() {

@@ -50,7 +50,7 @@ let i = list;

const { from } = Array;
export const toArray = list => {
export const toArray = (list) => {
const u = trampoline(list);
return u instanceof Array ? u : from(iterable(u));
};
const apply = f => input => () => {
const apply = (f) => (input) => () => {
const n = next(input);

@@ -64,3 +64,3 @@ if (n === null) {

export const flat = apply(flatStep);
const mapStep = f => ({ first, tail }) => ({ first: f(first), tail: map(f)(tail) });
const mapStep = (f) => ({ first, tail }) => ({ first: f(first), tail: map(f)(tail) });
export const map = f => apply(mapStep(f));

@@ -67,0 +67,0 @@ export const flatMap = f => compose(map(f))(flat);

import * as _ from "./module.f.js";
import * as json from "../../json/module.f.js";
import * as o from "../object/module.f.js";
const { sort } = o;
import * as operator from "../function/operator/module.f.js";
const { addition, strictEqual, reduceToScan } = operator;
import { sort } from "../object/module.f.js";
import { addition, strictEqual, reduceToScan } from "../function/operator/module.f.js";
const stringify = sequence => json.stringify(sort)(_.toArray(sequence));

@@ -8,0 +6,0 @@ const stringifyTest = () => {

@@ -1,5 +0,5 @@

import * as BtreeTypes from '../btree/types/module.f.ts';
import * as Compare from '../function/compare/module.f.ts';
import * as list from '../list/module.f.ts';
import * as Operator from '../function/operator/module.f.ts';
import type * as BtreeTypes from '../btree/types/module.f.ts';
import type * as Compare from '../function/compare/module.f.ts';
import { type List } from '../list/module.f.ts';
import type * as Operator from '../function/operator/module.f.ts';
export type Sign = Compare.Sign;

@@ -11,5 +11,5 @@ export type Entry<T> = readonly [string, T];

export declare const setReplace: (name: string) => <T>(value: T) => (map: Map<T>) => Map<T>;
export declare const entries: <T>(map: Map<T>) => list.List<Entry<T>>;
export declare const fromEntries: <T>(entries: list.List<Entry<T>>) => Map<T>;
export declare const entries: <T>(map: Map<T>) => List<Entry<T>>;
export declare const fromEntries: <T>(entries: List<Entry<T>>) => Map<T>;
export declare const remove: (name: string) => <T>(map: Map<T>) => Map<T>;
export declare const empty: null;

@@ -1,16 +0,7 @@

import * as BtreeTypes from "../btree/types/module.f.js";
import * as btf from "../btree/find/module.f.js";
const { value, find } = btf;
import * as bts from "../btree/set/module.f.js";
const { set } = bts;
import * as btr from "../btree/remove/module.f.js";
const { remove: btreeRemove } = btr;
import * as bt from "../btree/module.f.js";
const { values } = bt;
import * as Compare from "../function/compare/module.f.js";
import * as s from "../string/module.f.js";
const { cmp } = s;
import * as list from "../list/module.f.js";
const { fold } = list;
import * as Operator from "../function/operator/module.f.js";
import { value, find } from "../btree/find/module.f.js";
import { set } from "../btree/set/module.f.js";
import { remove as btreeRemove } from "../btree/remove/module.f.js";
import { values } from "../btree/module.f.js";
import { cmp } from "../string/module.f.js";
import { fold } from "../list/module.f.js";
const keyCmp = a => ([b]) => cmp(a)(b);

@@ -17,0 +8,0 @@ export const at = (name) => (map) => {

@@ -1,3 +0,2 @@

import * as _ from "./module.f.js";
const { at, setReplace, setReduce, empty, entries, remove } = _;
import { at, setReplace, setReduce, empty, entries, remove } from "./module.f.js";
import * as seq from "../list/module.f.js";

@@ -4,0 +3,0 @@ export default {

@@ -1,3 +0,3 @@

type NibbleSet = number;
type Nibble = number;
export type NibbleSet = number;
export type Nibble = number;
export declare const empty = 0;

@@ -10,2 +10,1 @@ export declare const universe = 65535;

export declare const setRange: (r: readonly [number, number]) => (s: NibbleSet) => NibbleSet;
export {};

@@ -1,3 +0,2 @@

import * as list from "../list/module.f.js";
const { every, map, countdown } = list;
import { every, map, countdown } from "../list/module.f.js";
import * as _ from "./module.f.js";

@@ -4,0 +3,0 @@ export default {

@@ -1,3 +0,2 @@

import * as _ from "./module.f.js";
const { sum, min, max, cmp } = _;
import { sum, min, max, cmp } from "./module.f.js";
export default {

@@ -4,0 +3,0 @@ sum: () => {

@@ -1,3 +0,3 @@

import * as list from '../list/module.f.ts';
import * as btMap from '../map/module.f.ts';
import { type List } from '../list/module.f.ts';
import { type Map as BtMap } from '../map/module.f.ts';
export type Map<T> = {

@@ -8,4 +8,4 @@ readonly [k in string]: T;

export declare const at: (name: string) => <T>(object: Map<T>) => T | null;
export declare const sort: <T>(e: list.List<Entry<T>>) => list.List<Entry<T>>;
export declare const fromEntries: <T>(e: list.List<Entry<T>>) => Map<T>;
export declare const fromMap: <T>(m: btMap.Map<T>) => Map<T>;
export declare const sort: <T>(e: List<Entry<T>>) => List<Entry<T>>;
export declare const fromEntries: <T>(e: List<Entry<T>>) => Map<T>;
export declare const fromMap: <T>(m: BtMap<T>) => Map<T>;

@@ -1,5 +0,3 @@

import * as list from "../list/module.f.js";
const { iterable } = list;
import * as btMap from "../map/module.f.js";
const { entries: mapEntries, fromEntries: mapFromEntries } = btMap;
import { iterable } from "../list/module.f.js";
import { entries as mapEntries, fromEntries as mapFromEntries } from "../map/module.f.js";
const { getOwnPropertyDescriptor, fromEntries: objectFromEntries } = Object;

@@ -6,0 +4,0 @@ export const at = name => object => {

@@ -1,6 +0,6 @@

import * as sortedList from '../sorted_list/module.f.ts';
import * as O from '../function/operator/module.f.ts';
import * as Range from '../range/module.f.ts';
import { type SortedList } from '../sorted_list/module.f.ts';
import type * as O from '../function/operator/module.f.ts';
import type * as Range from '../range/module.f.ts';
export type Entry<T> = [T, number];
export type RangeMap<T> = sortedList.SortedList<Entry<T>>;
export type RangeMap<T> = SortedList<Entry<T>>;
export type RangeMapArray<T> = readonly Entry<T>[];

@@ -7,0 +7,0 @@ export type Operators<T> = {

@@ -1,10 +0,4 @@

import * as sortedList from "../sorted_list/module.f.js";
const { genericMerge } = sortedList;
import * as list from "../list/module.f.js";
const { next } = list;
import * as Option from "../nullable/module.f.js";
import * as number from "../number/module.f.js";
const { cmp } = number;
import * as O from "../function/operator/module.f.js";
import * as Range from "../range/module.f.js";
import { genericMerge } from "../sorted_list/module.f.js";
import { next } from "../list/module.f.js";
import { cmp } from "../number/module.f.js";
const reduceOp = union => equal => state => ([aItem, aMax]) => ([bItem, bMax]) => {

@@ -11,0 +5,0 @@ const sign = cmp(aMax)(bMax);

@@ -1,3 +0,3 @@

type Ok<T> = readonly ['ok', T];
type Error<E> = readonly ['error', E];
export type Ok<T> = readonly ['ok', T];
export type Error<E> = readonly ['error', E];
export type Result<T, E> = Ok<T> | Error<E>;

@@ -7,2 +7,1 @@ export declare const ok: <T>(value: T) => Ok<T>;

export declare const unwrap: <T, E>(r: Result<T, E>) => T;
export {};

@@ -1,9 +0,9 @@

import * as compare from '../function/compare/module.f.ts';
import * as list from '../list/module.f.ts';
import * as option from '../nullable/module.f.ts';
export type SortedList<T> = list.List<T>;
import type * as compare from '../function/compare/module.f.ts';
import { type List } from '../list/module.f.ts';
import type * as option from '../nullable/module.f.ts';
export type SortedList<T> = List<T>;
type SortedArray<T> = readonly T[];
type Cmp<T> = (a: T) => (b: T) => compare.Sign;
export type ReduceOp<T, S> = (state: S) => (a: T) => (b: T) => readonly [option.Nullable<T>, compare.Sign, S];
export type TailReduce<T, S> = (state: S) => (tail: list.List<T>) => list.List<T>;
export type TailReduce<T, S> = (state: S) => (tail: List<T>) => List<T>;
type MergeReduce<T, S> = {

@@ -13,5 +13,5 @@ readonly reduceOp: ReduceOp<T, S>;

};
export declare const genericMerge: <T, S>({ reduceOp, tailReduce }: MergeReduce<T, S>) => (state: S) => (a: list.List<T>) => (b: list.List<T>) => list.List<T>;
export declare const genericMerge: <T, S>({ reduceOp, tailReduce }: MergeReduce<T, S>) => (state: S) => (a: List<T>) => (b: List<T>) => List<T>;
export declare const merge: <T>(cmp: Cmp<T>) => (a: SortedList<T>) => (b: SortedList<T>) => SortedList<T>;
export declare const find: <T>(cmp: Cmp<T>) => (value: T) => (array: SortedArray<T>) => T | null;
export {};

@@ -1,7 +0,3 @@

import * as compare from "../function/compare/module.f.js";
import * as list from "../list/module.f.js";
import * as option from "../nullable/module.f.js";
const { next } = list;
import * as f from "../function/module.f.js";
const { identity } = f;
import { next } from "../list/module.f.js";
import { identity } from "../function/module.f.js";
export const genericMerge = ({ reduceOp, tailReduce }) => {

@@ -8,0 +4,0 @@ const f = state => a => b => () => {

import * as _ from "./module.f.js";
import * as compare from "../function/compare/module.f.js";
const { unsafeCmp } = compare;
import { unsafeCmp } from "../function/compare/module.f.js";
import * as json from "../../json/module.f.js";
import * as object from "../object/module.f.js";
const { sort } = object;
import * as list from "../list/module.f.js";
const { toArray, countdown, length } = list;
import * as Map from "../map/module.f.js";
import * as f from "../function/module.f.js";
const { flip } = f;
import { sort } from "../object/module.f.js";
import { toArray, countdown, length } from "../list/module.f.js";
import { flip } from "../function/module.f.js";
const stringify = json.stringify(sort);

@@ -13,0 +8,0 @@ const reverseCmp = flip(unsafeCmp);

@@ -1,2 +0,2 @@

import * as Compare from '../function/compare/module.f.ts';
import type * as Compare from '../function/compare/module.f.ts';
export type SortedSet<T> = readonly T[];

@@ -3,0 +3,0 @@ type Cmp<T> = (a: T) => (b: T) => Compare.Sign;

@@ -1,6 +0,3 @@

import * as Compare from "../function/compare/module.f.js";
import * as list from "../list/module.f.js";
const { toArray } = list;
import * as sortedList from "../sorted_list/module.f.js";
const { merge, genericMerge, find } = sortedList;
import { toArray } from "../list/module.f.js";
import { merge, genericMerge, find } from "../sorted_list/module.f.js";
export const union = cmp => a => b => toArray(merge(cmp)(a)(b));

@@ -7,0 +4,0 @@ export const intersect = cmp => a => b => toArray(intersectMerge(cmp)(a)(b));

import * as _ from "./module.f.js";
import * as compare from "../function/compare/module.f.js";
const { unsafeCmp } = compare;
import { unsafeCmp } from "../function/compare/module.f.js";
import * as json from "../../json/module.f.js";
import * as object from "../object/module.f.js";
const { sort } = object;
import * as list from "../list/module.f.js";
const { toArray, countdown, length } = list;
import * as Map from "../map/module.f.js";
import * as f from "../function/module.f.js";
const { flip } = f;
import { sort } from "../object/module.f.js";
import { toArray, countdown, length } from "../list/module.f.js";
import { flip } from "../function/module.f.js";
const stringify = a => json.stringify(sort)(a);

@@ -13,0 +8,0 @@ const reverseCmp = flip(unsafeCmp);

@@ -1,2 +0,2 @@

import * as BtreeTypes from '../btree/types/module.f.ts';
import type * as BtreeTypes from '../btree/types/module.f.ts';
import { type List } from '../list/module.f.ts';

@@ -3,0 +3,0 @@ export declare const values: (s: StringSet) => List<string>;

@@ -1,14 +0,8 @@

import * as BtreeTypes from "../btree/types/module.f.js";
import * as btree from "../btree/module.f.js";
import * as btf from "../btree/find/module.f.js";
const { find, isFound } = btf;
import * as btr from "../btree/remove/module.f.js";
const { remove: btreeRemove } = btr;
import * as bts from "../btree/set/module.f.js";
const { set: btreeSet } = bts;
import * as string from "../string/module.f.js";
const { cmp } = string;
import { find, isFound } from "../btree/find/module.f.js";
import { remove as btreeRemove } from "../btree/remove/module.f.js";
import { set as btreeSet } from "../btree/set/module.f.js";
import { cmp } from "../string/module.f.js";
import { fold } from "../list/module.f.js";
import * as f from "../function/module.f.js";
const { compose } = f;
import { compose } from "../function/module.f.js";
export const values = btree.values;

@@ -15,0 +9,0 @@ export const empty = btree.empty;

@@ -1,6 +0,6 @@

import * as list from '../list/module.f.ts';
import { type List } from '../list/module.f.ts';
import * as compare from '../function/compare/module.f.ts';
export declare const join: (_: string) => (input: list.List<string>) => string;
export declare const concat: (input: list.List<string>) => string;
export declare const join: (_: string) => (input: List<string>) => string;
export declare const concat: (input: List<string>) => string;
export declare const repeat: (n: string) => (v: number) => string;
export declare const cmp: (a: string) => (b: string) => compare.Sign;

@@ -1,3 +0,2 @@

import * as list from "../list/module.f.js";
const { reduce: listReduce, repeat: listRepeat } = list;
import { reduce as listReduce, repeat as listRepeat } from "../list/module.f.js";
import { compose } from "../function/module.f.js";

@@ -4,0 +3,0 @@ import * as compare from "../function/compare/module.f.js";

@@ -1,5 +0,3 @@

import * as _ from "./module.f.js";
const { join, concat, repeat, cmp } = _;
import * as list from "../list/module.f.js";
const { repeat: repeatList } = list;
import { join, concat, repeat, cmp } from "./module.f.js";
import { repeat as repeatList } from "../list/module.f.js";
export default {

@@ -6,0 +4,0 @@ join: {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc