Skip to content

feat(core): add cond-> and cond--> macros for conditional threading - #1583

Open
sqrew wants to merge 1 commit into
carp-lang:masterfrom
sqrew:feat/cond-thread
Open

feat(core): add cond-> and cond--> macros for conditional threading#1583
sqrew wants to merge 1 commit into
carp-lang:masterfrom
sqrew:feat/cond-thread

Conversation

@sqrew

@sqrew sqrew commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

This PR adds the standard Clojure/Lisp cond-> and cond--> macros to Carp's standard library. These macros thread an expression through a series of forms, executing the forms only if their corresponding conditions evaluate to true.

Features:

  • Handles odd number of clauses via a descriptive macro error.
  • Works correctly with Carp's linear type system and borrow checker.
  • Evaluates the initial expression exactly once and isolates intermediate bindings cleanly using gensyms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants