{"id":18080224,"url":"https://github.com/zulu-inuoe/seq","last_synced_at":"2026-01-19T06:00:59.862Z","repository":{"id":72284352,"uuid":"116089278","full_name":"Zulu-Inuoe/seq","owner":"Zulu-Inuoe","description":"Clojure-style seqs in CL","archived":false,"fork":false,"pushed_at":"2023-02-01T14:43:19.000Z","size":304,"stargazers_count":10,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T21:46:16.540Z","etag":null,"topics":["algorithms","common-lisp","enumerable-types","generators","lazy-sequences"],"latest_commit_sha":null,"homepage":"","language":"Common Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Zulu-Inuoe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2018-01-03T03:59:20.000Z","updated_at":"2024-05-17T16:46:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"e7af5d04-3358-4ede-925c-c643f3e417de","html_url":"https://github.com/Zulu-Inuoe/seq","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Zulu-Inuoe/seq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zulu-Inuoe%2Fseq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zulu-Inuoe%2Fseq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zulu-Inuoe%2Fseq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zulu-Inuoe%2Fseq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Zulu-Inuoe","download_url":"https://codeload.github.com/Zulu-Inuoe/seq/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zulu-Inuoe%2Fseq/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28562228,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T03:31:16.861Z","status":"ssl_error","status_checked_at":"2026-01-19T03:31:15.069Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["algorithms","common-lisp","enumerable-types","generators","lazy-sequences"],"created_at":"2024-10-31T13:06:27.552Z","updated_at":"2026-01-19T06:00:59.799Z","avatar_url":"https://github.com/Zulu-Inuoe.png","language":"Common Lisp","funding_links":[],"categories":[],"sub_categories":[],"readme":"# seq\n\nLibrary for Clojure-style seqs in CL.\n\nProvides drivers for lists, sequences, hash tables, packages, streams, and optional support for:\n* [cl-containers](https://common-lisp.net/project/cl-containers/)\n* [fset](https://github.com/slburson/fset)\n* [trivial-gray-streams](https://github.com/trivial-gray-streams/trivial-gray-streams)\n\nEach available as an add-on system like `com.inuoe.seq.fset`.\n\nThere are additionally optional systems for [defining yield-style generators](src/seq.generators/seq.generators.lisp), a [rich C# Linq-like set of operations](src/seqio/seqio.lisp), and [an extensible iteration macro](src/doseq/doseq.lisp).\n\n## Usage\n\nSeqs provide a unified interface to a 'sequence' type, as well as the ability to trivially define generators via `lazy-seq`\n\n``` common-lisp\n(defpackage #:com.inuoe.seq-example1\n  (:use #:cl)\n  (:import-from\n    #:com.inuoe.seq\n    #:lazy-seq)\n  (:import-from\n    #:com.inuoe.doseq\n    #:doseq)\n  (:import-from\n    #:com.inuoe.seqio\n    #:select\n    #:skip\n    #:take\n    #:where))\n\n(in-package #:com.inuoe.seq-example1)\n\n;;Define an enumerable that represents all the natural numbers\n(defun natural-numbers ()\n  (labels ((recurse (i)\n           (lazy-seq\n             (cons i (recurse (1+ i))))))\n    (recurse 1)))\n\n;;Print the first 50 even numbers\n(doseq (n (take (where (natural-numbers) #'evenp) 50))\n  (print n))\n\n;;;CL sequence types, hash tables, and packages also enumerable\n\n;;Lists\n(doseq (x (select '(1 2 3) #'1+))\n  (print x)) ; prints 2 3 4\n\n;;Vectors\n(doseq (x (skip #(1 2 3) 2))\n  (print x)) ; prints 3\n\n;;Strings\n(doseq (x (take \"Hello, world!\" 5))\n  (print x)) ; prints #\\H #\\e #\\l #\\l #\\o\n\n;;Hash tables iterate over a cons who's car is the key, and cdr is the value\n(doseq (kvp (alexandria:alist-hash-table '((a . 0) (b . 1) (c . 2))))\n  (print kvp)) ; prints (A . 0), (B . 1) ...\n\n;;Packages iterate over the accessible symbols (eg do-symbols)\n(doseq (sym (find-package :cl))\n  (print sym)) ; prints.. a lot\n```\n\n## arrows\n\nIt might be worthwhile to also use one of the \"arrow\" packages with **seqio**\nfor better legibility. Check out [cl-arrows](https://github.com/nightfly19/cl-arrows) or\n[arrow-macros](https://github.com/hipeta/arrow-macros).\nIn the [serapeum](https://github.com/TBRSS/serapeum), the symbol `~\u003e` is used instead of `-\u003e`\n\nExamples:\n\n``` common-lisp\n(defpackage #:com.inuoe.seq-example2\n  (:use #:cl)\n  (:import-from\n    #:com.inuoe.seq.generators\n    #:with-generator)\n  (:import-from\n    #:com.inuoe.doseq\n    #:doseq)\n  (:import-from\n    #:com.inuoe.seqio\n    #:take\n    #:to-list\n    #:where))\n\n(in-package #:com.inuoe.seq-example2)\n\n;; Get a list of 5 random numbers\n(-\u003e (with-generator (loop (yield (random 10000)))) ; random numbers\n    (where #'evenp) ; that are even\n    (take 5)  ; take 5 of them\n    (to-list)) ; as a list\n=\u003e\n(7702 8872 2114 8144 7488) ; for example\n```\n\n## Defining new seq types\n\nImplementing a new seq type means providing seqable behaviour.\nSpecifically, at a minimum should define a `col-seq` implementation which returns a `seq`. A `seq` is an object with suitable `seq-first` and `seq-rest` specializations, or nil.\n\n`seq-first` should return the first element of `seq`, and `seq-rest` should return a seqable object.\n\nThe simplest implementation will just leverage the existing `lazy-seq`.\n\n### Optimization\n\n#### mapcol\n\nThe simplest way to optimize your type is to define a custom `mapcol` method.\nThis method is generally used by `doseq` when no specialized expander exists.\n\n#### seqio\n\nEach [seqio operation](src/seqio/seqio.lisp) may be specialized on.\n\n#### doseq\n\nFinally, using the `define-doseq-expander` macro allows you to define an inline\nloop expansion for your type. `doseq` will use this expansion when it is able to identify\nthe type, and as part of an inline type dispatcher.\n\nSee the [builtin expanders](src/doseq/doseq.lisp) for examples.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzulu-inuoe%2Fseq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzulu-inuoe%2Fseq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzulu-inuoe%2Fseq/lists"}