{"id":13618056,"url":"https://github.com/mmottl/pure-fun","last_synced_at":"2025-04-05T10:08:11.516Z","repository":{"id":18363598,"uuid":"21543819","full_name":"mmottl/pure-fun","owner":"mmottl","description":"Purely functional data structures for OCaml, translated from Chris Okasaki's book \"Purely Functional Data Structures\"","archived":false,"fork":false,"pushed_at":"2025-01-19T01:52:27.000Z","size":91,"stargazers_count":147,"open_issues_count":1,"forks_count":16,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-29T09:08:57.552Z","etag":null,"topics":["datastructures","ocaml","purely-functional-data-structures"],"latest_commit_sha":null,"homepage":null,"language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mmottl.png","metadata":{"files":{"readme":"README-Okasaki.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-07-06T16:31:52.000Z","updated_at":"2025-03-17T07:31:37.000Z","dependencies_parsed_at":"2024-12-14T08:17:00.932Z","dependency_job_id":"e8ce52d8-de7c-4360-a43a-23b032e88176","html_url":"https://github.com/mmottl/pure-fun","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmottl%2Fpure-fun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmottl%2Fpure-fun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmottl%2Fpure-fun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmottl%2Fpure-fun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mmottl","download_url":"https://codeload.github.com/mmottl/pure-fun/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247318744,"owners_count":20919484,"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":["datastructures","ocaml","purely-functional-data-structures"],"created_at":"2024-08-01T20:01:53.522Z","updated_at":"2025-04-05T10:08:11.495Z","avatar_url":"https://github.com/mmottl.png","language":"OCaml","funding_links":[],"categories":["OCaml"],"sub_categories":[],"readme":"# Purely Functional Data Structures\n\nThis directory contains the Standard ML source code from\n\n```text\nPurely Functional Data Structures\nChris Okasaki\nCambridge University Press, 1998\n```\n\nThe code is organized into files according to chapter, from `chp2.sml` to\n`chp11.sml`. Each file is self-contained, except for a few miscellaneous\ndefinitions in `base.sml`.\n\nThe code in the book assumes two non-standard language extensions: support for\nlazy evaluation and support for polymorphic recursion. I have modified the\non-line code to work around the lack of polymorphic recursion, but I have made\nonly minor changes regarding lazy evaluation. IN PARTICULAR, IF YOU COMPILE THE\nCODE \"AS IS\", IT WILL NOT USE LAZY EVALUATION, AND SO WILL NOT ACHIEVE THE\nRUNNING TIMES CLAIMED IN THE BOOK.\n\nIn the book, I assumed that lazy evaluation was supported in the language with a\n`$` operator: `$ exp` would create a suspension for the expression `exp`, and\nmatching that suspension against a pattern of the form `$ pat` would evaluate\nand memoize the suspension. In the on-line code, I simulate this with the\nfollowing definition in `base.sml`:\n\n```sml\ndatatype 'a susp = $ of 'a\n```\n\nBut, of course, this `$` constructor is not lazy!\n\nThere are two further differences related to lazy evaluation. First, the code\nin the book assumes that `$` parses with a lower precedence than an ordinary\nconstructor. Therefore, in the on-line code, I have replaced some occurrences\nof `$ exp` with `$ (exp)`. Second, the code in the book assumes the ability to\nwrite lazy functions using a special `fun lazy` syntax. In the on-line code, I\nhave eliminated dependence on this form.\n\nNote that Standard ML of New Jersey now supports lazy evaluation using a\nsimilar, but not quite identical, syntax. Updating the on-line code to use\ntheir syntax requires the following changes:\n\n- replace each occurrence of\n\n  ```sml\n  val s = $ (exp)\n  ```\n\n  with\n\n  ```sml\n  val lazy s = $ (exp)\n  ```\n\n- replace each remaining occurrence of\n\n  ```sml\n  ... $ (exp) ...\n  ```\n\n  with\n\n  ```sml\n  let val lazy s = $ (exp)\n  in ... s ... end\n  ```\n\nChris Okasaki \u003ccdo@cs.columbia.edu\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmottl%2Fpure-fun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmmottl%2Fpure-fun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmottl%2Fpure-fun/lists"}