{"id":23059443,"url":"https://github.com/miroox/lvalueref","last_synced_at":"2026-01-16T00:54:28.963Z","repository":{"id":136862150,"uuid":"166335406","full_name":"miRoox/LValueRef","owner":"miRoox","description":"Pointer semantics simulation in Wolfram Language","archived":false,"fork":false,"pushed_at":"2020-01-01T02:13:43.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-08T20:26:11.940Z","etag":null,"topics":["pointers","wolfram-language"],"latest_commit_sha":null,"homepage":"https://miroox.github.io/2019/01/PointerInWolfram/","language":"Mathematica","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/miRoox.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2019-01-18T03:08:33.000Z","updated_at":"2024-05-11T03:12:48.000Z","dependencies_parsed_at":"2024-07-14T13:46:49.423Z","dependency_job_id":null,"html_url":"https://github.com/miRoox/LValueRef","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miRoox%2FLValueRef","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miRoox%2FLValueRef/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miRoox%2FLValueRef/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miRoox%2FLValueRef/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miRoox","download_url":"https://codeload.github.com/miRoox/LValueRef/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246947315,"owners_count":20859269,"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":["pointers","wolfram-language"],"created_at":"2024-12-16T02:26:21.820Z","updated_at":"2026-01-16T00:54:28.924Z","avatar_url":"https://github.com/miRoox.png","language":"Mathematica","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ``LValueRef` ``\n\n[![GitHub Actions Status](https://github.com/miRoox/LValueRef/workflows/Test/badge.svg)](https://github.com/miRoox/LValueRef/actions)\n\nPointer semantics simulation in Wolfram Language.\n\n* `Ref[lvalue]` refers to `lvalue`.\n* `Deref[ref]` dereference.\n* `RefQ[expr]` check if `expr` is a reference.\n* `MakeRef[value]` create a reference with the `value`.\n* `ExpandDerefAsLValue[expr]` expands dereference in the `expr` as lvalue.\n\n### Usage\n\nLoad Package:\n\n```mathematica\nNeeds[\"LValueRef`\"]\n```\n\nDereference:\n\n```mathematica\na=1;\nb=Ref[a];\nDeref@b\n(*Out[*]= 1*)\n```\n\nL-value:\n\n```mathematica\na=1;\nb=Ref[a];\nDeref@b=2;\na\n(*Out[*]= 2*)\n```\n\nOr more complicated:\n\n```mathematica\na={1,2,3};\nb=Ref[a];\n(Deref@b)[[2]]=4;\na\n(*Out[*]= {1,4,3}*)\n```\n\nNot only symbols can be referenced:\n\n```mathematica\na={1,2,3};\nb=Ref[a[[2]]];\nDeref@b=4;\na\n(*Out[*]= {1,4,3}*)\n```\n\nMultiple references:\n\n```mathematica\na=1;\nb=Ref[a];\nc=Ref[b];\nDeref@Deref@c=2;\na\n(*Out[*]= 2*)\n```\n\nImplicit reference\n(`MakeRef` is similar to `new` in Java):\n\n```mathematica\na = MakeRef[1];\nDeref[a]\n(*Out[*]= 1*)\nDeref[a] = 2;\nDeref[a]\n(*Out[*]= 2*)\n```\n\n### Possible alternatives\n\nFor simple cases:\n\n```mathematica\na=1;\nra:=Unevaluated@@Hold[a]\nf[r_]:=r=2\nf[ra];\na\n(*Out[*]= 2*)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiroox%2Flvalueref","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiroox%2Flvalueref","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiroox%2Flvalueref/lists"}