{"id":15759255,"url":"https://github.com/nwtgck/random-access-machine-haskell","last_synced_at":"2025-03-31T09:09:58.976Z","repository":{"id":87735869,"uuid":"130193553","full_name":"nwtgck/random-access-machine-haskell","owner":"nwtgck","description":" Random Access Machine written in Haskell","archived":false,"fork":false,"pushed_at":"2022-01-16T04:30:19.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-02-06T13:30:30.662Z","etag":null,"topics":["haskell","haskell-stack","ram","random-access-machine","stack"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nwtgck.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2018-04-19T09:42:00.000Z","updated_at":"2022-01-16T04:30:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"33980f49-4f0f-41eb-b706-ab85bf021519","html_url":"https://github.com/nwtgck/random-access-machine-haskell","commit_stats":{"total_commits":10,"total_committers":2,"mean_commits":5.0,"dds":0.09999999999999998,"last_synced_commit":"15fef833cc79711e1043941bfcb5fe8811c3ffe5"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwtgck%2Frandom-access-machine-haskell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwtgck%2Frandom-access-machine-haskell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwtgck%2Frandom-access-machine-haskell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nwtgck%2Frandom-access-machine-haskell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nwtgck","download_url":"https://codeload.github.com/nwtgck/random-access-machine-haskell/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246443537,"owners_count":20778249,"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":["haskell","haskell-stack","ram","random-access-machine","stack"],"created_at":"2024-10-04T10:04:26.719Z","updated_at":"2025-03-31T09:09:58.954Z","avatar_url":"https://github.com/nwtgck.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# random-access-machine\n[![Build Status](https://travis-ci.com/nwtgck/random-access-machine-haskell.svg?token=TuxNpqznwwyy7hyJwBVm\u0026branch=develop)](https://travis-ci.com/nwtgck/random-access-machine-haskell)\n\nRandom Access Machine written in Haskell\n\n## Instructions\nThis Random Access Machine has 5 instructions.\n\n### `Z(i)`\nSet `0` to register `R(i)`\n\n### `S(i)`\nIncrement register `R(i)` by `1`\n\n### `M(i,j)`\nAssign value of `R(j)` to `R(i)`\n\n### `J(i,j,k)`\nJump to `k`th instruction if value of `R(i)` and `R(j)` are equal\n(NOTE: instruction is one origin)\n\n### `E`\nHalt program\n\n## Example\n\n```hs\nmodule Main where\n\nimport RandomAccessMachine\nimport Control.Monad.State\n\nsub1Prog = Program\n  [ J(1, 2, 5)\n  , S(2)\n  , S(0)\n  , J(0, 0, 1)\n  , E\n  ]\n\nmain :: IO ()\nmain = do\n  let (res, env) = execProgram sub1Prog [7, 4]   -- 7 - 4\n  print res\n  -- =\u003e 3\n  let (res, env) = execProgram sub1Prog [87, 23] -- 87 - 23\n  print res\n  -- 64\n```\n\n## Run Example\n\n```bash\nstack build \u0026\u0026 stack exec random-access-machine-examples\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnwtgck%2Frandom-access-machine-haskell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnwtgck%2Frandom-access-machine-haskell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnwtgck%2Frandom-access-machine-haskell/lists"}