{"id":15057191,"url":"https://github.com/jake-w-liu/BatchAssign.jl","last_synced_at":"2025-10-04T22:31:06.595Z","repository":{"id":244909374,"uuid":"816655428","full_name":"jake-w-liu/BatchAssign.jl","owner":"jake-w-liu","description":"The BatchAssign.jl module provides a convenient way to perform batch assignments in Julia.","archived":false,"fork":false,"pushed_at":"2025-08-18T06:35:57.000Z","size":17,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-22T06:02:39.181Z","etag":null,"topics":["julia"],"latest_commit_sha":null,"homepage":"","language":"Julia","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/jake-w-liu.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-06-18T06:54:18.000Z","updated_at":"2024-06-25T09:04:57.000Z","dependencies_parsed_at":"2025-09-04T00:44:19.514Z","dependency_job_id":"98dcb0e2-fb3b-48da-b9ea-841fb40237c1","html_url":"https://github.com/jake-w-liu/BatchAssign.jl","commit_stats":null,"previous_names":["akjake616/batchassign.jl","jake-w-liu/batchassign.jl"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jake-w-liu/BatchAssign.jl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jake-w-liu%2FBatchAssign.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jake-w-liu%2FBatchAssign.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jake-w-liu%2FBatchAssign.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jake-w-liu%2FBatchAssign.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jake-w-liu","download_url":"https://codeload.github.com/jake-w-liu/BatchAssign.jl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jake-w-liu%2FBatchAssign.jl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278386094,"owners_count":25978109,"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","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["julia"],"created_at":"2024-09-24T22:03:30.186Z","updated_at":"2025-10-04T22:31:06.269Z","avatar_url":"https://github.com/jake-w-liu.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BatchAssign.jl\n\n[![Build Status](https://github.com/akjake616/BatchAssign.jl/actions/workflows/CI.yml/badge.svg)](https://github.com/akjake616/BatchAssign.jl/actions/workflows/CI.yml)\n\nThe `BatchAssign.jl` module provides a convenient way to perform batch assignments in Julia using the macro `@all`. By leveraging metaprogramming techniques in Julia, this macro can assign a single value to multiple variables in one line, making your code cleaner and more concise.\n\n## Installation\n\nTo install the `BatchAssign` module, simply download it with the package manager:\n\n```julia\nusing Pkg\nPkg.add(\"BatchAssign\")\n```\n\n## Usage\n\nFirst, include the module in your script:\n\n```julia\nusing BatchAssign\n```\n\nThen, you can use the `@all` macro for batch assignments:\n\n```julia\n@all a b c = 1\n```\n\nThis line will assign the value `1` to variables `a`, `b`, and `c` simultaneously, and is equivalent to the following:\n\n```julia\na, b, c, = 1, 1, 1 # or, \na = b = c = 1\n```\nIt is noted that calling the following will assign disctinct random values for the variables:\n\n```julia\n@all a b c = rand()\n```\n\n\u003cbr\u003e\n\nThe macro is particularly useful for batch assignment of array to several variables:\n\n```julia\n@all A B C = zeros(2, 3) # case 1\n```\n\nThe above is ***NOT*** the same as the following:\n\n```julia\nA = B = C = zeros(2, 3) # case 2\n```\n\nsince changing the elements in one of the array in case 2 will affect the others (Julia arrays are assigned by reference).\n\n\u003cbr\u003e\n\nThe `@all` macro also supports compound assignments such as +=, -=, *=, and /= (and also the broadcasted ones). This allows you to update multiple variables simultaneously:\n\n```julia\n@all a b c += 1\n```\n\nFor more examples, please refer to [`runtest.jl`](./test/runtests.jl) in the test folder.\n\n## Benefits\n\n- **Conciseness:** Reduce multiple lines of assignments to a single line.\n- **Readability:** Enhance code readability by minimizing repetitive assignment lines.\n- **Efficiency:** Simplify the process of initializing multiple variables to the same value.\n\nEnjoy the simplicity of batch assignments with `@all`!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjake-w-liu%2FBatchAssign.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjake-w-liu%2FBatchAssign.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjake-w-liu%2FBatchAssign.jl/lists"}