{"id":18509969,"url":"https://github.com/archywillhe/structurallyrecursivegameoflife","last_synced_at":"2025-05-14T11:13:50.523Z","repository":{"id":88737646,"uuid":"46213159","full_name":"archywillhe/StructurallyRecursiveGameOfLife","owner":"archywillhe","description":"Most functions are structurally recursive","archived":false,"fork":false,"pushed_at":"2015-11-15T10:58:55.000Z","size":0,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-17T02:41:34.615Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Haskell","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/archywillhe.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":"2015-11-15T10:26:03.000Z","updated_at":"2016-01-29T10:12:33.000Z","dependencies_parsed_at":"2023-03-09T06:22:05.013Z","dependency_job_id":null,"html_url":"https://github.com/archywillhe/StructurallyRecursiveGameOfLife","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archywillhe%2FStructurallyRecursiveGameOfLife","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archywillhe%2FStructurallyRecursiveGameOfLife/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archywillhe%2FStructurallyRecursiveGameOfLife/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/archywillhe%2FStructurallyRecursiveGameOfLife/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/archywillhe","download_url":"https://codeload.github.com/archywillhe/StructurallyRecursiveGameOfLife/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254129537,"owners_count":22019629,"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-06T15:19:52.301Z","updated_at":"2025-05-14T11:13:50.473Z","avatar_url":"https://github.com/archywillhe.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## StructurallyRecursiveGameOfLife: a simple Haskell implementation of the [Game of Life](https://en.wikipedia.org/wiki/The_Game_of_Life).\n\n\u003e Each live cell is represented by an ordered pair i.e. a pair in Haskell e.g. `(0,0)`,  and each state is represented by a set of cells i.e. (for the sake of simplicity) a list of pars in Haskell e.g. `[(0,0),(1,0),(1,1)]` .\n\nThis is certainly not the most efficient implementation of the Game of Life, nor is it the shortest implementation (sorry to disappoint you [code-golffer](https://en.wikipedia.org/wiki/Code_golf) out there). But this is no doubt one of the simplest ways of implementing the game of life using the functional approach.\n\n## Summary\n\nIn this implementation, the function `survive` is responsible for the 1st, 2nd and 3rd rules, which can be expressed as \"a live cell stays alive [iff](https://en.wikipedia.org/wiki/If_and_only_if) it has 2 and 3 neighbours\", while the function `produce` is responsible for the 4th rule, which can be expressed as \"iff exactly 3 live cells has a neighbour in common, and that neighbour is not a live cell, it would be alive after this iteration\".\n\n## Quick Start\n\n```\ncabal run\n```\n\n## Most functions in this implementation are structurally recursive\n\nBasically, a function `f` is structurally recursive when the return is either\n\n1. calling `f` again, or some other function that calls `f`\n\n2. some value (aka the base-case).\n\nHere is an example:\n\n```\npowerset [] = [[]]\npowerset (x:xs) = [ x:ns | ns \u003c- recursion] ++ recursion\n  where recursion = powerset xs\n```\n\nThis would return the [power set](https://en.wikipedia.org/wiki/Power_set) equivalence of a list.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchywillhe%2Fstructurallyrecursivegameoflife","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farchywillhe%2Fstructurallyrecursivegameoflife","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchywillhe%2Fstructurallyrecursivegameoflife/lists"}