{"id":13590417,"url":"https://github.com/clojure-cookbook/clojure-cookbook","last_synced_at":"2025-05-14T21:10:22.984Z","repository":{"id":8909539,"uuid":"10634239","full_name":"clojure-cookbook/clojure-cookbook","owner":"clojure-cookbook","description":"This is the home of O'Reilly's Clojure Cookbook - http://clojure-cookbook.com","archived":false,"fork":false,"pushed_at":"2024-01-12T10:11:30.000Z","size":11402,"stargazers_count":2600,"open_issues_count":41,"forks_count":435,"subscribers_count":186,"default_branch":"master","last_synced_at":"2025-04-06T13:08:03.211Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"rails/arel","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clojure-cookbook.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-06-12T01:11:34.000Z","updated_at":"2025-03-23T01:20:12.000Z","dependencies_parsed_at":"2024-05-01T14:04:25.727Z","dependency_job_id":null,"html_url":"https://github.com/clojure-cookbook/clojure-cookbook","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clojure-cookbook%2Fclojure-cookbook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clojure-cookbook%2Fclojure-cookbook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clojure-cookbook%2Fclojure-cookbook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clojure-cookbook%2Fclojure-cookbook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clojure-cookbook","download_url":"https://codeload.github.com/clojure-cookbook/clojure-cookbook/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248741201,"owners_count":21154255,"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":[],"created_at":"2024-08-01T16:00:45.048Z","updated_at":"2025-04-13T16:10:27.652Z","avatar_url":"https://github.com/clojure-cookbook.png","language":"Clojure","funding_links":[],"categories":["Clojure","info","Guides"],"sub_categories":[],"readme":"# Clojure Cookbook\n\n*Clojure Cookbook* marks Clojure's entry into O'Reilly's prestigious [Cookbook Series](http://shop.oreilly.com/category/series/cookbooks.do). The book details a large number of recipes – pairs of problems and solutions – for common topics in Clojure.\n\n*Clojure Cookbook* doesn't just teach you Clojure, it also shows you how to use the language and many of its common libraries. The most difficult part of mastering any language is knowing how to apply it, in an idiomatic way, to tasks that real software developers encounter every day. This is especially true of Clojure.\n\nWith code recipes that teach you how to use the language in a variety of domains, *Clojure Cookbook* goes beyond simply teaching Clojure syntax and semantics. It contains annotated example code with detailed analysis and explanation for hundreds of real programming tasks. You can read the book straight through to gain insights about Clojure, or use it as a reference to solve particular problems.\n\n## Exploring the Book\n\nIf you're an Emacs-wielding Clojurist, you will probably want to read this book in Emacs, too. Here is a function that \"turns the page\" from one recipe to the next (find and open the next recipe, close the buffer with the previous recipe).\n\n```elisp\n(defun increment-clojure-cookbook ()\n  \"When reading the Clojure cookbook, find the next section, and\nclose the buffer. If the next section is a sub-directory or in\nthe next chapter, open Dired so you can find it manually.\"\n  (interactive)\n  (let* ((cur (buffer-name))\n\t (split-cur (split-string cur \"[-_]\"))\n\t (chap (car split-cur))\n\t (rec (car (cdr split-cur)))\n\t (rec-num (string-to-number rec))\n\t (next-rec-num (1+ rec-num))\n\t (next-rec-s (number-to-string next-rec-num))\n\t (next-rec (if (\u003c next-rec-num 10)\n\t\t       (concat \"0\" next-rec-s)\n\t\t     next-rec-s))\n\t (target (file-name-completion (concat chap \"-\" next-rec) \"\")))\n    (progn \n      (if (equal target nil)\n\t  (dired (file-name-directory (buffer-file-name)))\n\t(find-file target))\n      (kill-buffer cur))))\n```\n\nIf you wish, you can then bind the function to a key:\n\n```elisp\n(define-key adoc-mode-map (kbd \"M-+\") 'increment-clojure-cookbook)\n```\n\nOf course, this binding assumes you're using adoc-mode for reading .asciidoc files. We suggest CIDER for evaluating code interactively. Adding the following hook to your config will enable cider-mode every time you enter an AsciiDoc file. Once active, you can start a REPL and evaluate code like you would do in any regular Clojure file.\n\n```elisp\n(add-hook 'adoc-mode-hook 'cider-mode)\n```\n\n## Contributing\n\nAs of Jan. 10, 2014 we are preparing the book for print. See [CONTRIBUTING.md](CONTRIBUTING.md) for more info.\n\n## Building the Book\n\nYou can build a PDF/MOBI/EPUB/HTML version of the book with the `asciidoc`\ncommand-line utility.  (You must also have the `source-highlight` application\ninstalled and properly configured.)\n\n### Pre-requisites\n\nYou must have the `asciidoc` and `source-highlight` command-line utilities\ninstalled and configured before attempting to build the book.\n\nTo install and configure the tools on OS X or Linux,\nrun the included [`bootstrap.sh`](script/asciidoc/bootstrap.sh) script:\n\n```sh\n$ ./script/asciidoc/bootstrap.sh\n```\n\n### Rendering\n\nWith installation and configuration complete, all that is left is to run the `asciidoc` command.\n\n* To render a single document:\n\n    ```sh\n    $ asciidoc -b html5 conventions.asciidoc\n    # ... outputs conventions.html\n    ```\n\n* To render the entire book:\n\n    ```sh\n    $ asciidoc -b html5 book.asciidoc\n    # ... outputs book.html\n    ```\n\n**NOTE**: Rendered output is *similar* to the final book, but does not include O'Reilly style sheets.\n\n### Testing\n\nTo verify asciidoc files are without error/warning, run the following:\n\n```sh\n$ ./script/asciidoc/check.sh\n```\nThe only output should be the file detail.\n\n\n#### Fixing Asciidoc Warnings/Errors\n\nThe only acceptable warning is related to structure of the book sections. It's\nOK to ignore this one:\n\n```\nasciidoc: WARNING: conventions.asciidoc: line 1: section title out of sequence: expected level 1, got level 2\n```\n\nPlease correct all others or ask for guidance if the error message is unclear.\nA common one is related to callouts like \"\\\u003c1\\\u003e\" at the end of a line of code.\n\n```\nasciidoc: WARNING: formatting-strings.asciidoc: line 57: no callouts refer to list item 1\n```\n\nTo prevent this warning, the callout must be commented using the language\nappropriate comment character(s). This also keeps the code runnable in the REPL\nwhen pasted.\n\nClojure Example:\n\n```clojure\n(defn foo [] \"bar\" ) \u003c1\u003e\n```\n\nrequires a semicolon before the callout reference\n\n```clojure\n(defn foo [] \"bar\" ) ; \u003c1\u003e\n```\n\nConsole Example:\n```sh\nUsername: \u003c1\u003e\n```\n\nshould be\n\n```sh\nUsername: #\u003c1\u003e\n```\n\n## Who we are\n\nWe are Luke Vanderhart ([@levand](http://github.com/levand)) and Ryan Neufeld ([@rkneufeld](http://github.com/rkneufeld)), developers, authors, conference speakers and (at the moment), teachers. For this book-building adventure we will be your guides; we'll be collecting and editing your contributions, interfacing with the publisher (O'Reilly) and writing a solid chunk of the book ourselves.\n\n## License\n\n\u003ca rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc-nd/3.0/deed.en_US\"\u003e\u003cimg alt=\"Creative Commons License\" style=\"border-width:0\" src=\"http://i.creativecommons.org/l/by-nc-nd/3.0/88x31.png\" /\u003e\u003c/a\u003e\u003cbr /\u003e\u003cspan xmlns:dct=\"http://purl.org/dc/terms/\" property=\"dct:title\"\u003eThis draft of Clojure Cookbook\u003c/span\u003e is licensed under a \u003ca rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc-nd/3.0/deed.en_US\"\u003eCreative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License\u003c/a\u003e.\n\n\nPlease see the [contribution guide](CONTRIBUTING.md) for how this works for accepting pull requests.\n\nAlso, please note that because this is a *No Derivatives* license, you may *not* use this repository as a basis for creating your own book based on this one. Technically speaking, this book is open source in the \"free as in beer\" sense, rather than \"free as in speech.\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclojure-cookbook%2Fclojure-cookbook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclojure-cookbook%2Fclojure-cookbook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclojure-cookbook%2Fclojure-cookbook/lists"}