{"id":23948570,"url":"https://github.com/propan/circular-buffer","last_synced_at":"2025-10-05T03:21:16.977Z","repository":{"id":8592115,"uuid":"10226783","full_name":"propan/circular-buffer","owner":"propan","description":"a persistent circular buffer","archived":false,"fork":false,"pushed_at":"2013-05-22T19:09:53.000Z","size":128,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T20:51:19.739Z","etag":null,"topics":["circular-buffer","clojure"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/propan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-05-22T18:24:59.000Z","updated_at":"2022-12-07T19:49:30.000Z","dependencies_parsed_at":"2022-07-31T02:38:08.970Z","dependency_job_id":null,"html_url":"https://github.com/propan/circular-buffer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/propan/circular-buffer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propan%2Fcircular-buffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propan%2Fcircular-buffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propan%2Fcircular-buffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propan%2Fcircular-buffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/propan","download_url":"https://codeload.github.com/propan/circular-buffer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propan%2Fcircular-buffer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278403442,"owners_count":25981047,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["circular-buffer","clojure"],"created_at":"2025-01-06T10:19:31.285Z","updated_at":"2025-10-05T03:21:16.954Z","avatar_url":"https://github.com/propan.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# circular-buffer\n\nAn implementation of persistent circular buffer. Implements most of Clojure collections interfaces (and therefore supports\nmethods like *conj*, *into*, *nth*, etc) as well as Java collections interfaces.\n\nThe implementation provides the following options:\n\n* **:type** -      defines the type of values, that will be stored in the buffer and therefore the type of the structure\n                   that backs the buffer (either **clojure.core.Vec** or **clojure.lang.PersistentVector**).\n                   Possible values are *:any :int :long :float :double :byte :short :char* or *:boolean*. \n                   **Default:** *:any*\n\n* **:default** -   defines the default value in the buffer. If omitted depends on the type of values for which the\n                   buffer is configured.\n                   **Default:** *nil, 0, 0.0 or false*\n\n* **:direction** - defines the direction in which new elements are added into the buffer.\n                   **Default:** *:left*\n\n\n\n## Usage\n\nInclude the library in your leiningen project dependencies:\n\n```clojure\n[circular-buffer \"0.1.0-SNAPSHOT\"]\n```\n\n## Examples\n\n```clojure\n(use 'hamakar.circular-buffer)\n\n; defines a new circular buffer of size 5\n(def cb-left (cbuf 5)) ; #'hamakar.circular-buffer/cb-left\n\ncb-left ; [nil nil nil nil nil]\n\n(conj cb-left 4) ; [nil nil nil nil 4]\n\n(into cb-left [1 2 3 4 5 6 7 8]) ; [4 5 6 7 8]\n\n(subvec (into cb-left [1 2 3 4 5 6 7 8]) 2) ; [6 7 8]\n\n(def cb-left (cbuf 4 :type :int :default -1)) ; #'hamakar.circular-buffer/cb-left\n\ncb-left ; [-1 -1 -1 -1]\n\n(def cb-right (into (cbuf 4 :direction :right) [1 2 3 4])) ; #'hamakar.circular-buffer/cb-right\n\ncb-right ; [4 3 2 1]\n\n(pop cb-right) ; [3 2 1 nil]\n\n(peek cb-right) ; 4\n\n(= cb-right (list 4 3 2 1)) ; true\n\n(nth cb-right 0) ; 4\n```\n\n## License\n\nCopyright © 2013 Pavel Prokopenko\n\nDistributed under the Eclipse Public License, the same as Clojure.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpropan%2Fcircular-buffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpropan%2Fcircular-buffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpropan%2Fcircular-buffer/lists"}