{"id":18553000,"url":"https://github.com/cryptosense/enumerators","last_synced_at":"2025-06-16T07:33:20.229Z","repository":{"id":36187662,"uuid":"40491852","full_name":"cryptosense/enumerators","owner":"cryptosense","description":"Finite lazy enumerators in OCaml","archived":false,"fork":false,"pushed_at":"2018-10-19T15:42:31.000Z","size":43,"stargazers_count":22,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-10T15:52:47.822Z","etag":null,"topics":["enumerator","lazy-evaluation","ocaml-library"],"latest_commit_sha":null,"homepage":null,"language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cryptosense.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-10T16:01:56.000Z","updated_at":"2021-03-24T16:47:41.000Z","dependencies_parsed_at":"2022-08-02T13:14:32.816Z","dependency_job_id":null,"html_url":"https://github.com/cryptosense/enumerators","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/cryptosense/enumerators","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryptosense%2Fenumerators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryptosense%2Fenumerators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryptosense%2Fenumerators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryptosense%2Fenumerators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cryptosense","download_url":"https://codeload.github.com/cryptosense/enumerators/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cryptosense%2Fenumerators/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260119284,"owners_count":22961505,"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":["enumerator","lazy-evaluation","ocaml-library"],"created_at":"2024-11-06T21:15:47.017Z","updated_at":"2025-06-16T07:33:20.170Z","avatar_url":"https://github.com/cryptosense.png","language":"OCaml","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build status](https://api.travis-ci.org/cryptosense/enumerators.svg)](https://travis-ci.org/cryptosense/enumerators)\n\nFinite lazy enumerators\n=======================\n\nThe *enumerators* library enables you to work with large sequences of elements.\n\nExample\n-------\n\nLet's assume you want to scan ports of a few hosts on your network.  Your first task is to\nenumerate those ports.  Naturally, as the list can grow big, you don't want to have them\nall in memory at the same time.  This is were this library comes into play.\n\nIn this example, targets have the type `string * int` where the first element is the IP\naddress and the second element is the network port.  Here is a function to print such a\ntarget:\n\n```ocaml\nlet print_target (ip, port) =\n  Printf.printf \"[%s]:%d\\n\" ip port\n```\n\nThe following instructions will enable you to get a listing of the targets:\n\n  * Define the address enumerator from a list of strings with `make`.\n  * Define the port enumerator with `range`.\n  * Define the enumerator for targets as a cartesian product of the addresses and the\n    ports with `product`.\n  * Iterate over this final enumerator to print each element.\n\nHere's how you can do it:\n\n```ocaml\nlet () =\n  let addresses = Enumerator.make [\"2001:db8::1\"; \"2001:db8::2\"] in\n  let ports = Enumerator.range 1 1024 in\n  let targets = Enumerator.product addresses ports in\n  Enumerator.iter print_target targets\n```\n\nYou should get the following output:\n\n```\n[2001:db8::1]:1\n[2001:db8::2]:1\n[2001:db8::1]:2\n[2001:db8::2]:2\n[2001:db8::1]:3\n[2001:db8::2]:3\n...\n```\n\nLicensing\n---------\n\nThis library is available under the 2-clause BSD license. See `LICENSE.md` for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcryptosense%2Fenumerators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcryptosense%2Fenumerators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcryptosense%2Fenumerators/lists"}