{"id":19392073,"url":"https://github.com/davidraab/seq","last_synced_at":"2025-04-24T01:32:35.800Z","repository":{"id":207618760,"uuid":"719639837","full_name":"DavidRaab/Seq","owner":"DavidRaab","description":"A Perl lazy Sequence implementation","archived":true,"fork":false,"pushed_at":"2023-12-02T10:49:03.000Z","size":279,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-24T21:12:31.459Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DavidRaab.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":"LICENSE","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":"2023-11-16T15:39:10.000Z","updated_at":"2024-02-11T13:48:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"b20a295b-a3cf-4916-96fb-66630fba66c3","html_url":"https://github.com/DavidRaab/Seq","commit_stats":null,"previous_names":["davidraab/seq"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidRaab%2FSeq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidRaab%2FSeq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidRaab%2FSeq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DavidRaab%2FSeq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DavidRaab","download_url":"https://codeload.github.com/DavidRaab/Seq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250544110,"owners_count":21448043,"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-11-10T10:30:20.369Z","updated_at":"2025-04-24T01:32:35.531Z","avatar_url":"https://github.com/DavidRaab.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nSeq - A lazy sequence implementation\n\n# SYNOPSIS\n\nThe Seq module provides a lazy sequence implementation that can be\nexecuted multiple times. A sequence just represent a computation without\ncomputing any values until they are requested.\n\nDifferent to iterators they can be executed multiple times. A sequence\ncan somehow considered an immutable iterator.\n\nAt the moment Documentation is lacking, but the source-code is well-documented\nincluding the test-files. Maybe you want to look at the test-files until\nI have written more documentation. The API is not fully stable at the moment\nand can be changed.\n\n```perl\nuse v5.36;\nuse Seq;\n\n# Fibonacci Generator\nmy $fib =\n    Seq-\u003econcat(\n        Seq-\u003ewrap(1,1),\n        Seq-\u003eunfold([1,1], sub($state) {\n            my $next = $state-\u003e[0] + $state-\u003e[1];\n            return $next, [$state-\u003e[1],$next];\n        })\n    );\n\n# prints: 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765\n$fib-\u003etake(20)-\u003eiter(sub($x) {\n    say $x;\n});\n\n# Represents all possible combinations\n# [[clubs =\u003e 7], [clubs =\u003e 8], [clubs =\u003e 9], ...]\nmy $cards =\n    Seq::cartesian(\n        Seq-\u003ewrap(qw/clubs spades hearts diamond/),\n        Seq-\u003ewrap(qw/7 8 9 10 B D K A/)\n    );\n\nuse Path::Tiny qw(path);\n# get the maximum id from test-files so far\nmy $maximum_id =\n    Seq\n    -\u003ewrap(   path('t')-\u003echildren )\n    -\u003emap(    sub($x) { $x-\u003ebasename })\n    -\u003echoose( sub($x) { $x =~ m/\\A(\\d+) .* \\.t\\z/xms ? $1 : undef } )\n    -\u003emax;\n```\n\n# EXPORT\n\nThis modules does not export anything by default. But you can request the following\nfunctions: id, fst, snd, key, assign\n\n# CONSTRUCTORS\n\nThis module uses functional-programming as the main paradigm. Functions are\ndivided into constructors, methods and converters.\n\nConstructor create a sequence. Methods operate on sequences and return\nanother new sequence. Converter transforms a sequence to some other data-type.\n\nMethods are called methods for convenience, but no object-orientation is\ninvolved. Perls OO capabilities are only used as a chaning mechanism.\n\nConstructors must be called with the Package name. Functions that operate\non Sequences can either be called as a method or directly from the Package.\n\n```perl\nmy $range =\n    Seq\n    -\u003ewrap(1,2,3)\n    -\u003eappend(Seq-\u003ewrap(4,5,6));\n```\n\nor\n\n```perl\nmy $range =\n    Seq::append(\n        Seq-\u003ewrap(1,2,3),\n        Seq-\u003ewrap(4,5,6),\n    )\n```\n\n## $seq = Seq-\u003eempty()\n\nReturns an empty sequence. Useful as an initial state or as a starting point.\n\n```perl\nSeq-\u003eempty-\u003eappend( $another_seq )\n```\n\n## $seq = Seq-\u003erange($start, $stop)\n\nReturns a sequence from $start to $stop. Range can also be backwards. $start\nand $stop are inclusive.\n\n```perl\nSeq-\u003erange(1, 5); # 1,2,3,4,5\nSeq-\u003erange(5, 1); # 5,4,3,2,1\nSeq-\u003erange(1, 1); # 1\n```\n\n## $seq = Seq-\u003ewrap(...)\n\nJust takes whatever you pass it to, and puts it in a sequence. This should be\nyour primarily way to create a sequence with values.\n\n```perl\nSeq-\u003ewrap(qw/Hello World/); # \"Hello\", \"World\"\nSeq-\u003ewrap(1 .. 10);         # AVOID this, use Seq-\u003erange(1, 10) instead.\nSeq-\u003ewrap(@array);\n```\n\n## $seq = Seq-\u003econcat(@sequences)\n\nTakes multiple *Sequences* and returns a single flattened sequence.\n\n```perl\n# 1, 2, 3, 4, 5, 5, 4, 3, 2, 1\nSeq-\u003econcat(\n    Seq-\u003erange(1, 5),\n    Seq-\u003erange(5, 1),\n);\n```\n\n# MISSING DOC\n\nImplemented, but not documented yet:\n\nfrom_sub, unfold, init, range_step, from_list, from_array, from_hash\n\n# METHODS\n\nImplemented, but not documented yet:\n\nappend, map, bind, flatten cartesian, join, merge, select*, choose, mapi,\nfilter, take, skip, indexed, distinct, distinct_by, iter, do, rev\n\n* will maybe change\n\n# CONVERTERS\n\nImplemented, but not documented yet:\n\nfold, reduce, first, last, to_array, to_list, count, sum, sum_by, min,\nmin_by, min_by_str, max, max_str, max_by, max_by_str, str_join, to_hash,\ngroup_by, find\n\n# Github\n\nDevelopment project is on Github [Perl-Seq](https://github.com/DavidRaab/Seq)\n\n# SUPPORT\n\nYou can find documentation for this module with the perldoc command.\n\n    perldoc Seq\n\nYou can also look for information at [my Blog on Perl Seq](https://davidraab.github.io/tags/perl-seq/)\n\n# AUTHOR\n\nDavid Raab, C\u003c\u003c \u003cdavidraab83 at gmail.com\u003e \u003e\u003e\n\n# LICENSE AND COPYRIGHT\n\nThis software is Copyright (c) 2023 by David Raab.\n\nThis is free software, licensed under:\n\n  The MIT (X11) License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidraab%2Fseq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidraab%2Fseq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidraab%2Fseq/lists"}