{"id":19204649,"url":"https://github.com/walmartlabs/cond-let","last_synced_at":"2025-05-12T16:09:28.711Z","repository":{"id":62431974,"uuid":"151440264","full_name":"walmartlabs/cond-let","owner":"walmartlabs","description":"A useful merge of cond and let","archived":false,"fork":false,"pushed_at":"2018-12-05T21:39:59.000Z","size":9,"stargazers_count":30,"open_issues_count":0,"forks_count":3,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-17T01:24:37.544Z","etag":null,"topics":["clojure"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/walmartlabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-03T15:59:42.000Z","updated_at":"2023-07-25T14:20:21.000Z","dependencies_parsed_at":"2022-11-01T20:45:40.573Z","dependency_job_id":null,"html_url":"https://github.com/walmartlabs/cond-let","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walmartlabs%2Fcond-let","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walmartlabs%2Fcond-let/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walmartlabs%2Fcond-let/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/walmartlabs%2Fcond-let/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/walmartlabs","download_url":"https://codeload.github.com/walmartlabs/cond-let/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253773923,"owners_count":21962195,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure"],"created_at":"2024-11-09T13:09:10.192Z","updated_at":"2025-05-12T16:09:28.665Z","avatar_url":"https://github.com/walmartlabs.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# com.walmartlabs/cond-let\n\n[![Clojars Project](https://img.shields.io/clojars/v/com.walmartlabs/cond-let.svg)](https://clojars.org/com.walmartlabs/cond-let)\n\n\u003e Like this?  By publishing it, I found out about [better-cond](https://github.com/Engelberg/better-cond) which has a super-set of the features here.\n  Go use it with my blessing!  I do!\n\n\nA micro-library around the useful `cond-let` macro.\n\n`cond-let` acts like a `cond`, but adds\n`:let` terms that are followed by a binding form (like `let`).\n\nThis allows conditional code to introduce new local symbols; the result\nis clearer, more linear code, that doesn't make a march for the\nright margin.\n\n[API Documentation](http://walmartlabs.github.io/apidocs/cond-let/)\n\n## Usage\n\nAn example from the Clockwork library:\n\n```clj\n(defn ^:private has-necessary-capabilities?\n  \"Does the worker have all the capabilities that the job needs?\"\n  [state worker-id task]\n  (cond-let\n\n    :let [job-id (:job-id task)]\n\n    (nil? job-id)\n    true\n\n    :let [capabilities (get-in state [:jobs job-id :clockwork/required-capabilities])]\n\n    (empty? capabilities)\n    true\n\n    :let [worker-capabilities (get-in state [:workers worker-id :capabilities])]\n\n    (empty? worker-capabilities)\n    false\n\n    :else\n    ;; It's ok for the worker to have *more* capabilities than are specified.\n    ;; For each required capability, we need an exact match.\n    (= (select-keys worker-capabilities (keys capabilities))\n       capabilities)))\n```\n\n## License\n\nCopyright © 2018 Walmart\n\nDistributed under the Apache Software License 2.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwalmartlabs%2Fcond-let","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwalmartlabs%2Fcond-let","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwalmartlabs%2Fcond-let/lists"}