Skip to content

Commit

Permalink
refactor(pointfree): re-use comp() from thi.ng/compose
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Dec 27, 2018
1 parent 1ebfea9 commit 3f9b244
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 53 deletions.
3 changes: 2 additions & 1 deletion packages/pointfree/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"dependencies": {
"@thi.ng/api": "^4.2.4",
"@thi.ng/checks": "^1.5.14",
"@thi.ng/compose": "^0.2.2",
"@thi.ng/equiv": "^0.1.15",
"@thi.ng/errors": "^0.1.12"
},
Expand All @@ -50,4 +51,4 @@
"publishConfig": {
"access": "public"
}
}
}
48 changes: 0 additions & 48 deletions packages/pointfree/src/comp.ts

This file was deleted.

7 changes: 3 additions & 4 deletions packages/pointfree/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { IObjectOf } from "@thi.ng/api/api";
import { isArray } from "@thi.ng/checks/is-array";
import { isFunction } from "@thi.ng/checks/is-function";
import { isPlainObject } from "@thi.ng/checks/is-plain-object";
import { compL } from "@thi.ng/compose/comp";
import { equiv as _equiv } from "@thi.ng/equiv";
import { illegalArgs } from "@thi.ng/errors/illegal-arguments";
import { illegalState } from "@thi.ng/errors/illegal-state";

import {
Stack,
StackContext,
Expand All @@ -14,7 +14,7 @@ import {
StackProc,
StackProgram
} from "./api";
import { comp } from "./comp";


let SAFE = true;

Expand Down Expand Up @@ -95,7 +95,7 @@ const $stackFn = (f: StackProc) =>
const tos = (stack: Stack) => stack[stack.length - 1];

const compile = (prog: StackProgram) =>
comp.apply(null, prog.map(
compL.apply(null, prog.map(
(w) => !isFunction(w) ?
(ctx: StackContext) => (ctx[0].push(w), ctx) :
w));
Expand Down Expand Up @@ -1793,4 +1793,3 @@ export const printrs = (ctx: StackContext) =>
(console.log(ctx[1]), ctx);

export * from "./api";
export * from "./comp";

0 comments on commit 3f9b244

Please sign in to comment.