Registry / serialization / jambda-calc

jambda-calc

JSON →
library0.6.1jsnpmunverified

jambda-calc (v0.6.1) is a TypeScript library that transpiles JavaScript/TypeScript functions into pure lambda calculus expressions and visualizes them as Tromp diagrams. It supports arithmetic, common operators, conditionals, nested functions, and basic array methods like .filter() and .map(). The library is in active development with a focus on educational and explorative use—ideal for understanding the theoretical underpinnings of computation. It provides a CLI tool and programmatic API, with TypeScript definitions included. Notable limitations include no support for string operations, recursion, async functions, imports, or advanced member functions. The project aims to handle entire JS projects in the future.

npm install jambda-calc
INSTALL
IMPORT
SIG · JAMBDA-CALC
J
jambda-calc
serializationjavascriptv0.6.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

transpile
import { transpile } from 'jambda-calc';
const transpile = require('jambda-calc').transpile;
ESM-only; use import syntax. TypeScript types are included.
visualize
import { visualize } from 'jambda-calc';
import { viz } from 'jambda-calc';
The default export is not provided; use named imports.
jambdaCalc
import { jambdaCalc } from 'jambda-calc';
import jambdaCalc from 'jambda-calc';
The library does not have a default export; use named import.

Transpile a simple addition function to lambda calculus and visualize the result as a Tromp diagram SVG.

import { transpile, visualize } from 'jambda-calc'; import * as fs from 'fs'; // Transpile a simple arithmetic function const jsCode = 'function add(a, b) { return a + b; }'; const lambdaExpr = transpile(jsCode); console.log('Lambda expression:', lambdaExpr); // Visualize the expression as Tromp diagram SVG const svg = visualize(lambdaExpr, { format: 'svg' }); fs.writeFileSync('add-tromp.svg', svg);
jambda-calc --version
Debug
Known issues
breakingUnsupported operations (string, recursion, async, imports) will throw an error or produce incorrect results.
fix
Ensure input code only uses supported features: arithmetic, boolean/numbers, conditionals, simple functions, .filter(), .map().
affects: >=0.6.0
gotchaNumber literals only supported in range -100 to 100.
fix
Use only numbers between -100 and 100; larger numbers will cause errors.
affects: >=0.6.0
gotchaCLI must be run via pnpm or npx; global install does not expose command.
fix
Use `pnpm jambda-calc` or `npx jambda-calc` from project directory.
affects: >=0.6.0
Errors
Common errors & fixes
Error: Unsupported operation: Math.cos
Member functions other than .filter() and .map() are not implemented.
fix
Replace Math.cos() with a manual computation or avoid such functions.
Error: Number literal out of range: 150
Only numbers from -100 to 100 are supported.
fix
Reduce the number to within [-100, 100] or restructure the logic.
Error: Cannot find module 'jambda-calc'
Package not installed in the project or not on the path.
fix
Run `pnpm install jambda-calc` (or npm/yarn) in the project directory. Verify node_modules and package.json.
Upgrade
Version history
0.6.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
jambda-calc — npm install jambda-calc · libregistry