nw-fp-clojure

Solid

Clojure language-specific patterns, data-first modeling, REPL-driven development, and spec

AI & Automation 526 stars 55 forks Updated 1 weeks ago MIT

Install

View on GitHub

Quality Score: 95/100

Stars 20%
91
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# FP in Clojure -- Functional Software Crafter Skill Cross-references: [fp-principles](../nw-fp-principles/SKILL.md) | [fp-domain-modeling](../nw-fp-domain-modeling/SKILL.md) ## When to Choose Clojure - Best for: data-centric domains | REPL-driven exploration | rapid prototyping | frequently evolving data shapes - Not ideal for: teams wanting compile-time type safety | Android | teams unfamiliar with Lisp syntax ## [STARTER] Quick Setup ```bash # Install Clojure CLI brew install clojure/tools/clojure # macOS # Create project mkdir -p order-service/src/order_service order-service/test/order_service # Run REPL: clj | Run tests: clj -X:test ``` **Namespace caveat**: Clojure namespaces use `-` but filenames use `_` (JVM requirement). `order-service.core` lives in `order_service/core.clj`. ## [STARTER] Domain Modeling with Spec Clojure is dynamically typed. Domain modeling uses maps with qualified keywords, validated at runtime. ```clojure (require '[clojure.spec.alpha :as s]) ;; Domain wrappers as specs (s/def ::order-id pos-int?) (s/def ::email (s/and string? #(clojure.string/includes? % "@"))) (s/def ::customer-name (s/and string? #(> (count %) 0))) ;; Record types as spec'd maps (s/def ::customer (s/keys :req [::customer-name ::email] :opt [::phone])) ;; Choice types as spec alternatives (s/def ::payment-method (s/or :credit-card (s/keys :req [::card-number ::expiry-date]) :bank-transfer (s/keys :req [::account-number]) :cash #{:cash})) ``` ### ...

Details

Author
nWave-ai
Repository
nWave-ai/nWave
Created
3 months ago
Last Updated
1 weeks ago
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category