How kumarpit/lamb works
Project type and purpose
• lamb(iguous) is a small, open‑source JavaScript/TypeScript library (an NPM package) implementing a generalized backtracking (“amb”) search operator à la SICP.
• Its goal is to expose a simple, declarative API (the Lamb<T> class) so client code can define choice variables and constraints, and then automatically search for satisfying assignments.
File structure
Top‑level:
• error.ts – defines custom error classes (e.g., ambiguous failure)
• example.ts – usage examples or demos
• index.ts – public entry point, exports the Lamb class and API
• __tests__/lamb.test.js – unit tests against the built library
• tsconfig.json, .npmignore, .gitignore, package*.json – config, build, packaging
lib/:
• *.js, *.d.ts – transpiled outputs ready for publishing
Patterns & architecture implications:
• Single-package library, no frontend/backends split
• Core engine lives in index.ts (and possibly split into internal helpers)
• Error handling in error.ts
• Build pipeline compiles TS → JS + type declarations for consumers
• Testing harness against lib/ outputs
README for additional insights
• Core concepts: addChoice, addConstraint, solve methods
• Usage examples: simple sum‑to‑n, map‑coloring, eight‑queens
• No built‑in persistence or external service calls; purely in‑memory search
• Heavily relies on JavaScript callbacks and recursion