{"id":16469258,"url":"https://github.com/soveran/stal","last_synced_at":"2025-03-23T11:32:39.474Z","repository":{"id":59156319,"uuid":"76655650","full_name":"soveran/stal","owner":"soveran","description":"Set algebra solver for Redis","archived":false,"fork":false,"pushed_at":"2016-12-23T09:26:32.000Z","size":5,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-02T00:12:17.236Z","etag":null,"topics":["lesscode","lua","redis","set-algebra"],"latest_commit_sha":null,"homepage":"","language":"Lua","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/soveran.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-16T13:26:23.000Z","updated_at":"2021-04-15T22:52:29.000Z","dependencies_parsed_at":"2022-09-13T20:11:33.354Z","dependency_job_id":null,"html_url":"https://github.com/soveran/stal","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/soveran%2Fstal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soveran%2Fstal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soveran%2Fstal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soveran%2Fstal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soveran","download_url":"https://codeload.github.com/soveran/stal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244296985,"owners_count":20430336,"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":["lesscode","lua","redis","set-algebra"],"created_at":"2024-10-11T12:06:30.092Z","updated_at":"2025-03-23T11:32:39.444Z","avatar_url":"https://github.com/soveran.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"Stal\n====\n\nSet algebra solver for Redis.\n\nDescription\n-----------\n\n`Stal` receives an array with an s-expression composed of commands\nand key names and resolves the set operations in [Redis][redis].\n\nCommunity\n---------\n\nMeet us on IRC: [#lesscode](irc://chat.freenode.net/#lesscode) on\n[freenode.net](http://freenode.net/).\n\nGetting started\n---------------\n\nInstall [Redis][redis]. On most platforms it's as easy as grabbing\nthe sources, running make and then putting the `redis-server` binary\nin the PATH.\n\nOnce you have it installed, you can execute `redis-server` and it\nwill run on `localhost:6379` by default. Check the `redis.conf`\nfile that comes with the sources if you want to change some settings.\n\nUsage\n-----\n\n`Stal` is a Lua script for Redis that receives a JSON formatted\ns-expression and resolves the set algebra operations.\n\n```\n# Populate some sets\n$ redis-cli SADD A 1 2 3\n(integer) 3\n$ redis-cli SADD B 2 3 4\n(integer) 3\n$ redis-cli SADD C 3 4 5\n(integer) 3\n\n# Calculate the intersection of A and B\n$ redis-cli --eval stal.lua , '[\"SINTER\", \"A\", \"B\"]'\n1) \"2\"\n2) \"3\"\n```\n\nMore complex expressions are possible:\n\n```\n$ redis-cli --eval stal.lua , '[\"SDIFF\", [\"SUNION\", \"A\", \"C\"], \"B\"]'\n1) \"1\"\n2) \"5\"\n```\n\n`Stal` translates the internal calls to  `SDIFF`, `SINTER`, `SUNION`,\n`ZINTER` and `ZUNION` into `SDIFFSTORE`, `SINTERSTORE`, `SUNIONSTORE`,\n`ZINTERSTORE` and `ZUNIONSTORE` respectively in order to perform\nthe underlying operations, and it takes care of generating and\ndeleting any temporary keys. Furthermore, the temporary keys are\nnot replicated to the slaves and are not appended to AOF.\n\nAll the nested commands in the s-expression will have a temporary\nkey passed as the first argument. That means only commands that can\nmake sense of that feature can be used in nested expressions.\n\n```\n$ redis-cli --eval stal.lua , '[\"SINTER\", [\"SADD\", \"4\", \"5\" \"6\"], \"C\"]'\n1) \"4\"\n2) \"5\"\n```\n\nThe outermost command can be practically anything, for example:\n\n```\n$ redis-cli --eval stal.lua , '[\"DBSIZE\"]'\n(integer) 3\n$ redis-cli --eval stal.lua , '[\"SCARD\", [\"SUNION\", \"A\", \"B\", \"C\"]]'\n(integer) 5\n```\n\nInstallation\n------------\n\nCopy the script and use it directly as shown in the examples. You\ncan also use a [wrapper](#wrappers) in your preferred programming\nlanguage.\n\nWrappers\n--------\n\nThe following wrappers are available:\n\n- [Stal for Ruby](https://github.com/soveran/stal-ruby)\n- [Stal for Crystal](https://github.com/soveran/stal-crystal)\n\nDevelopment\n-----------\n\nThe tests are written in Lua and can be run as follows:\n\n```\n $ lua stal_test.lua\n```\n\nAlternatively you can run `make`. If there's no output, it means\nall the assertions passed.\n\n[redis]: http://redis.io\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoveran%2Fstal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoveran%2Fstal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoveran%2Fstal/lists"}