Skip to content

Commit

Permalink
refactor(transducers): update imports
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Sep 6, 2020
1 parent d7bd006 commit e166cda
Show file tree
Hide file tree
Showing 47 changed files with 79 additions and 79 deletions.
2 changes: 1 addition & 1 deletion packages/transducers/src/internal/drain.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isReduced } from "../reduced";
import type { Fn } from "@thi.ng/api";
import type { ReductionFn } from "../api";
import { isReduced } from "../reduced";

/**
* Helper HOF yielding a buffer drain completion function for some
Expand Down
2 changes: 1 addition & 1 deletion packages/transducers/src/internal/mathop.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { $$reduce, reducer } from "../reduce";
import type { FnAny } from "@thi.ng/api";
import type { Reducer, ReductionFn } from "../api";
import { $$reduce, reducer } from "../reduce";

/**
* Higher-order reducer for math operations.
Expand Down
2 changes: 1 addition & 1 deletion packages/transducers/src/iter/concat.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ensureIterable } from "@thi.ng/arrays";
import type { Nullable } from "@thi.ng/api";
import { ensureIterable } from "@thi.ng/arrays";

/**
* Yields iterator producing concatenation of given iterables.
Expand Down
2 changes: 1 addition & 1 deletion packages/transducers/src/iter/sorted-keys.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { compare } from "@thi.ng/compare";
import type { Comparator } from "@thi.ng/api";
import { compare } from "@thi.ng/compare";

/**
* Syntax sugar for `Object.keys(x).sort()` with support for custom
Expand Down
2 changes: 1 addition & 1 deletion packages/transducers/src/iter/tween.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Fn2 } from "@thi.ng/api";
import { normRange } from "./norm-range";
import { repeat } from "./repeat";
import type { Fn2 } from "@thi.ng/api";

export interface TweenOpts<A, B, C> {
/**
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/reduce.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Fn0, FnAny } from "@thi.ng/api";
import { implementsFunction, isArrayLike, isIterable } from "@thi.ng/checks";
import { illegalArity } from "@thi.ng/errors";
import { isReduced, unreduced } from "./reduced";
import type { Fn0, FnAny } from "@thi.ng/api";
import type { IReducible, Reducer, ReductionFn } from "./api";
import { isReduced, unreduced } from "./reduced";

const parseArgs = (args: any[]) =>
args.length === 2
Expand Down
2 changes: 1 addition & 1 deletion packages/transducers/src/rfn/assoc-map.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { reduce, reducer } from "../reduce";
import type { Pair } from "@thi.ng/api";
import type { Reducer } from "../api";
import { reduce, reducer } from "../reduce";

/**
* Reducer accepting key-value pairs / tuples and transforming / adding
Expand Down
2 changes: 1 addition & 1 deletion packages/transducers/src/rfn/assoc-obj.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { reduce, reducer } from "../reduce";
import type { IObjectOf, Pair } from "@thi.ng/api";
import type { Reducer } from "../api";
import { reduce, reducer } from "../reduce";

/**
* Reducer accepting key-value pairs / tuples and updating / adding them
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/rfn/every.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { $$reduce, reducer } from "../reduce";
import { reduced } from "../reduced";
import type { Predicate } from "@thi.ng/api";
import type { Reducer } from "../api";
import { $$reduce, reducer } from "../reduce";
import { reduced } from "../reduced";

/**
* Reducer which applies optional `pred` function to each value and
Expand Down
2 changes: 1 addition & 1 deletion packages/transducers/src/rfn/fill.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { $$reduce, reducer } from "../reduce";
import type { NumericArray } from "@thi.ng/api";
import type { Reducer } from "../api";
import { $$reduce, reducer } from "../reduce";

/**
* Reducer which starts filling array with results from given `start`
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/rfn/frequencies.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Fn } from "@thi.ng/api";
import { identity } from "@thi.ng/compose";
import type { Reducer } from "../api";
import { $$reduce } from "../reduce";
import { count } from "./count";
import { groupByMap } from "./group-by-map";
import type { Fn } from "@thi.ng/api";
import type { Reducer } from "../api";

export function frequencies<A>(): Reducer<Map<A, number>, A>;
export function frequencies<A>(xs: Iterable<A>): Map<A, number>;
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/rfn/group-binary.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { groupByObj } from "./group-by-obj";
import { push } from "./push";
import type { Fn, Fn0, IObjectOf } from "@thi.ng/api";
import type { Reducer } from "../api";
import { groupByObj } from "./group-by-obj";
import { push } from "./push";

const branchPred = <T>(
key: Fn<T, number>,
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/rfn/group-by-obj.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { __groupByOpts } from "../internal/group-opts";
import { $$reduce } from "../reduce";
import type { IObjectOf } from "@thi.ng/api";
import type { GroupByOpts, Reducer } from "../api";
import { __groupByOpts } from "../internal/group-opts";
import { $$reduce } from "../reduce";

// prettier-ignore
export function groupByObj<SRC, GROUP>(opts?: Partial<GroupByOpts<SRC, PropertyKey, GROUP>>): Reducer<IObjectOf<GROUP>, SRC>;
Expand Down
2 changes: 1 addition & 1 deletion packages/transducers/src/rfn/last.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NO_OP } from "@thi.ng/api";
import { reduce, reducer } from "../reduce";
import type { Reducer } from "../api";
import { reduce, reducer } from "../reduce";

export function last<T>(): Reducer<T, T>;
export function last<T>(xs: Iterable<T>): T;
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/rfn/max-compare.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { compare } from "@thi.ng/compare";
import { $$reduce, reducer } from "../reduce";
import type { Comparator, Fn0 } from "@thi.ng/api";
import { compare } from "@thi.ng/compare";
import type { Reducer } from "../api";
import { $$reduce, reducer } from "../reduce";

export function maxCompare<T>(init: Fn0<T>, cmp?: Comparator<T>): Reducer<T, T>;
export function maxCompare<T>(init: Fn0<T>, xs: Iterable<T>): T;
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/rfn/min-compare.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { compare } from "@thi.ng/compare";
import { $$reduce, reducer } from "../reduce";
import type { Comparator, Fn0 } from "@thi.ng/api";
import { compare } from "@thi.ng/compare";
import type { Reducer } from "../api";
import { $$reduce, reducer } from "../reduce";

export function minCompare<T>(init: Fn0<T>, cmp?: Comparator<T>): Reducer<T, T>;
export function minCompare<T>(init: Fn0<T>, xs: Iterable<T>): T;
Expand Down
2 changes: 1 addition & 1 deletion packages/transducers/src/rfn/push-sort.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { compare } from "@thi.ng/compare";
import type { Comparator } from "@thi.ng/api";
import { compare } from "@thi.ng/compare";
import type { Reducer } from "../api";

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/rfn/some.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { $$reduce, reducer } from "../reduce";
import { reduced } from "../reduced";
import type { Predicate } from "@thi.ng/api";
import type { Reducer } from "../api";
import { $$reduce, reducer } from "../reduce";
import { reduced } from "../reduced";

/**
* Similar to {@link (every:1)} reducer, but only requires at least 1 value to
Expand Down
2 changes: 1 addition & 1 deletion packages/transducers/src/run.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Fn, NO_OP } from "@thi.ng/api";
import { transduce } from "./transduce";
import type { IReducible, Reducer, TxLike } from "./api";
import { transduce } from "./transduce";

const NO_OP_REDUCER: Reducer<void, any> = [NO_OP, NO_OP, NO_OP];

Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/xform/cat.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { compR } from "../func/compr";
import { ensureReduced, isReduced, unreduced } from "../reduced";
import type { Nullable } from "@thi.ng/api";
import type { Reducer, Transducer } from "../api";
import { compR } from "../func/compr";
import { ensureReduced, isReduced, unreduced } from "../reduced";

/**
* Transducer to concatenate iterable values. Iterates over each input
Expand Down
2 changes: 1 addition & 1 deletion packages/transducers/src/xform/converge.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Predicate2, SEMAPHORE } from "@thi.ng/api";
import type { Reducer, Transducer } from "../api";
import { compR } from "../func/compr";
import { $iter } from "../iterator";
import { ensureReduced } from "../reduced";
import type { Reducer, Transducer } from "../api";

/**
* Transducer which for each input `x` (apart from the very first one)
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/xform/convolve.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { Fn, Fn0 } from "@thi.ng/api";
import { illegalArgs } from "@thi.ng/errors";
import type { Reducer, Transducer } from "../api";
import { range } from "../iter/range";
import { range2d } from "../iter/range2d";
import { zip } from "../iter/zip";
import { iterator1 } from "../iterator";
import { add } from "../rfn/add";
import { transduce } from "../transduce";
import { map } from "./map";
import type { Fn, Fn0 } from "@thi.ng/api";
import type { Reducer, Transducer } from "../api";

export type ConvolutionKernel1D = [number, number][];
export type ConvolutionKernel2D = [number, [number, number]][];
Expand Down
2 changes: 1 addition & 1 deletion packages/transducers/src/xform/dedupe.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Predicate2, SEMAPHORE } from "@thi.ng/api";
import type { Reducer, Transducer } from "../api";
import { compR } from "../func/compr";
import { $iter } from "../iterator";
import type { Reducer, Transducer } from "../api";

export function dedupe<T>(equiv?: Predicate2<T>): Transducer<T, T>;
export function dedupe<T>(src: Iterable<T>): IterableIterator<T>;
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/xform/distinct.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { compR } from "../func/compr";
import { $iter } from "../iterator";
import type { Fn, Fn0 } from "@thi.ng/api";
import type { Reducer, Transducer } from "../api";
import { compR } from "../func/compr";
import { $iter } from "../iterator";

export interface DistinctOpts<T> {
/**
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/xform/drop-while.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { compR } from "../func/compr";
import { $iter } from "../iterator";
import type { Predicate } from "@thi.ng/api";
import type { Reducer, Transducer } from "../api";
import { compR } from "../func/compr";
import { $iter } from "../iterator";

export function dropWhile<T>(pred?: Predicate<T>): Transducer<T, T>;
export function dropWhile<T>(src: Iterable<T>): IterableIterator<T>;
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/xform/filter-fuzzy.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Fn, Predicate2 } from "@thi.ng/api";
import { fuzzyMatch } from "@thi.ng/arrays";
import type { Transducer } from "../api";
import { $iter } from "../iterator";
import { filter } from "./filter";
import type { Fn, Predicate2 } from "@thi.ng/api";
import type { Transducer } from "../api";

export interface FilterFuzzyOpts<A, B> {
/**
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/xform/filter.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Predicate } from "@thi.ng/api";
import { isIterable } from "@thi.ng/checks";
import type { Reducer, Transducer } from "../api";
import { compR } from "../func/compr";
import { iterator1 } from "../iterator";
import type { Predicate } from "@thi.ng/api";
import type { Reducer, Transducer } from "../api";

export function filter<T>(pred: Predicate<T>): Transducer<T, T>;
export function filter<T>(
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/xform/interleave.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Fn0 } from "@thi.ng/api";
import { isIterable } from "@thi.ng/checks";
import type { Reducer, Transducer } from "../api";
import { compR } from "../func/compr";
import { iterator } from "../iterator";
import { isReduced } from "../reduced";
import type { Fn0 } from "@thi.ng/api";
import type { Reducer, Transducer } from "../api";

export function interleave<A, B>(sep: B | Fn0<B>): Transducer<A, A | B>;
export function interleave<A, B>(
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/xform/interpolate.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { Fn2 } from "@thi.ng/api";
import { isIterable } from "@thi.ng/checks";
import type { Transducer } from "../api";
import { comp } from "../func/comp";
import { normRange } from "../iter/norm-range";
import { iterator } from "../iterator";
import { map } from "./map";
import { mapcat } from "./mapcat";
import { partition } from "./partition";
import type { Fn2 } from "@thi.ng/api";
import type { Transducer } from "../api";

/**
* Higher order interpolation transducer. The resulting transducer forms
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/xform/interpose.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Fn0 } from "@thi.ng/api";
import { isIterable } from "@thi.ng/checks";
import type { Reducer, Transducer } from "../api";
import { compR } from "../func/compr";
import { iterator } from "../iterator";
import { isReduced } from "../reduced";
import type { Fn0 } from "@thi.ng/api";
import type { Reducer, Transducer } from "../api";

export function interpose<A, B>(sep: B | Fn0<B>): Transducer<A, A | B>;
export function interpose<A, B>(
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/xform/keep.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Fn, Nullable } from "@thi.ng/api";
import { identity } from "@thi.ng/compose";
import type { Reducer, Transducer } from "../api";
import { compR } from "../func/compr";
import { $iter } from "../iterator";
import type { Fn, Nullable } from "@thi.ng/api";
import type { Reducer, Transducer } from "../api";

export function keep<T>(
pred?: Fn<Nullable<T>, any>
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/xform/map-indexed.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { compR } from "../func/compr";
import { $iter } from "../iterator";
import type { Fn2 } from "@thi.ng/api";
import type { Reducer, Transducer } from "../api";
import { compR } from "../func/compr";
import { $iter } from "../iterator";

/**
* Transducer. Similar to {@link (map:1)}, but given `fn` takes two
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/xform/map-keys.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { $iter } from "../iterator";
import { map } from "./map";
import type { Fn2, IObjectOf } from "@thi.ng/api";
import type { Transducer } from "../api";
import { $iter } from "../iterator";
import { map } from "./map";

/**
* Takes a `keys` object of transformation functions and returns a
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/xform/map-nth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { compR } from "../func/compr";
import { $iter } from "../iterator";
import type { Fn } from "@thi.ng/api";
import type { Reducer, Transducer } from "../api";
import { compR } from "../func/compr";
import { $iter } from "../iterator";

/**
* Transducer. Similar to {@link (map:1)}, but only transforms every
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/xform/map-vals.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { $iter } from "../iterator";
import { map } from "./map";
import type { Fn, IObjectOf } from "@thi.ng/api";
import type { Transducer } from "../api";
import { $iter } from "../iterator";
import { map } from "./map";

/**
* Transducer. Similar to {@link (map:1)}, but expects object values and
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/xform/map.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Fn } from "@thi.ng/api";
import { isIterable } from "@thi.ng/checks";
import type { Reducer, Transducer } from "../api";
import { compR } from "../func/compr";
import { iterator1 } from "../iterator";
import type { Fn } from "@thi.ng/api";
import type { Reducer, Transducer } from "../api";

/**
* Transducer. Applies mapping function `fn` to each received value and
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/xform/mapcat.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Fn } from "@thi.ng/api";
import { isIterable } from "@thi.ng/checks";
import type { Transducer } from "../api";
import { comp } from "../func/comp";
import { iterator } from "../iterator";
import { cat } from "./cat";
import { map } from "./map";
import type { Fn } from "@thi.ng/api";
import type { Transducer } from "../api";

/**
* Transducer. Similar to {@link (map:1)}, but expects the given mapping
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/xform/match-first.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Predicate } from "@thi.ng/api";
import { isIterable } from "@thi.ng/checks";
import type { Transducer } from "../api";
import { comp } from "../func/comp";
import { iterator1 } from "../iterator";
import { filter } from "./filter";
import { take } from "./take";
import type { Predicate } from "@thi.ng/api";
import type { Transducer } from "../api";

/**
* Transducer composition / syntax sugar for:
Expand Down
4 changes: 2 additions & 2 deletions packages/transducers/src/xform/match-last.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Predicate } from "@thi.ng/api";
import { isIterable } from "@thi.ng/checks";
import type { Transducer } from "../api";
import { comp } from "../func/comp";
import { iterator } from "../iterator";
import { filter } from "./filter";
import { takeLast } from "./take-last";
import type { Predicate } from "@thi.ng/api";
import type { Transducer } from "../api";

/**
* Transducer composition / syntax sugar for:
Expand Down
Loading

0 comments on commit e166cda

Please sign in to comment.