{"id":19198994,"url":"https://github.com/witchcrafters/operator","last_synced_at":"2025-12-12T00:27:59.690Z","repository":{"id":46249704,"uuid":"71103187","full_name":"witchcrafters/operator","owner":"witchcrafters","description":"Helpers for defining Elixir operators","archived":false,"fork":false,"pushed_at":"2021-11-04T04:22:50.000Z","size":50,"stargazers_count":23,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-20T10:42:01.885Z","etag":null,"topics":["macros","operators"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","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/witchcrafters.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-17T05:34:55.000Z","updated_at":"2024-07-25T14:02:45.000Z","dependencies_parsed_at":"2022-09-07T17:35:28.076Z","dependency_job_id":null,"html_url":"https://github.com/witchcrafters/operator","commit_stats":null,"previous_names":["expede/operator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/witchcrafters%2Foperator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/witchcrafters%2Foperator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/witchcrafters%2Foperator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/witchcrafters%2Foperator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/witchcrafters","download_url":"https://codeload.github.com/witchcrafters/operator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253171998,"owners_count":21865435,"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":["macros","operators"],"created_at":"2024-11-09T12:25:14.861Z","updated_at":"2025-12-12T00:27:59.657Z","avatar_url":"https://github.com/witchcrafters.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://raw.githubusercontent.com/expede/operator/master/brand/logo.png)\n## Helpers for defining Elixir operators\n\n[![Build Status](https://travis-ci.org/expede/operator.svg?branch=master)](https://travis-ci.org/expede/operator) [![Inline docs](http://inch-ci.org/github/expede/operator.svg?branch=master)](http://inch-ci.org/github/expede/operator) [![Deps Status](https://beta.hexfaktor.org/badge/all/github/expede/operator.svg)](https://beta.hexfaktor.org/github/expede/operator) [![hex.pm version](https://img.shields.io/hexpm/v/operator.svg?style=flat)](https://hex.pm/packages/operator) [![API Docs](https://img.shields.io/badge/api-docs-yellow.svg?style=flat)](http://hexdocs.pm/operator/) [![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/expede/operator/blob/master/LICENSE)\n\n# Quick Start\n\n```elixir\n\ndef deps do\n  [{:operator, \"~\u003e 0.2.0\"}]\nend\n\ndefmodule MyModule do\n  use Operator\n\n  @operator :~\u003e\n  # ...\nend\n```\n\n# Summary\n\nHelpers for defining operator aliases for functions\n\nOperators can be hard to follow, especially with the limited number available\nin Elixir. Always having a named function backing an operator makes it easy to\nfall back to the named version. Named fall backs are also very useful for\npiping (`|\u003e`).\n\n```elixir\n\ndefmodule Example do\n  use Operator\n\n  @doc \"Divide two numbers\"\n  @operator :~\u003e\n  def divide(a, b), do: a / b\n\n  @doc \"Multiply two numbers\"\n  @operator :\u003c~\u003e\n  def multiply(a, b), do: a * b\nend\n\nimport Example\n\ndivide(10, 5)\n#=\u003e 5\n\n10 ~\u003e 2\n#=\u003e 5\n\nmultiply(10, 2)\n#=\u003e 20\n\n10 \u003c~\u003e 2\n#=\u003e 20\n\n```\n\n# Operator Reference\n\nElixir has a limited number of available operators. Many of them are already used\nby `Kernel` (the standard lib). You _can_ overwrite the standard definition\nby excluding it from the import of `Kernel`, but this is not advisable\n(except in very exceptional cases), because it can be very confusing for users.\n\nSome operators have multiple arities, and can be defined separately.\nSome binary operators associate to the left, and others to the right.\nPlease refer to the table below.\n\n| Operator | Unary              | Left-associated Binary | Right-associated Binary |\n|:--------:|:------------------:|:----------------------:|:-----------------------:|\n| `!`      | :heavy_check_mark: |                        |                         |\n| `@`      | :heavy_check_mark: |                        |                         |\n| `.`      |                    | :heavy_check_mark:     |                         |\n| `..`     |                    |                        | :heavy_check_mark:      |\n| `+`      | :heavy_check_mark: | :heavy_check_mark:     |                         |\n| `++`     |                    |                        | :heavy_check_mark:      |\n| `-`      | :heavy_check_mark: | :heavy_check_mark:     |                         |\n| `--`     |                    |                        | :heavy_check_mark:      |\n| `*`      |                    | :heavy_check_mark:     |                         |\n| `/`      |                    | :heavy_check_mark:     |                         |\n| `^`      | :heavy_check_mark: |                        |                         |\n| `^^^`    |                    | :heavy_check_mark:     |                         |\n| `~~~`    | :heavy_check_mark: |                        |                         |\n| `\u0026`      | :heavy_check_mark: |                        |                         |\n| `\u0026\u0026`     |                    | :heavy_check_mark:     |                         |\n| `\u0026\u0026\u0026`    |                    | :heavy_check_mark:     |                         |\n| `\u003c-`     |                    | :heavy_check_mark:     |                         |\n| `\\\\`     |                    | :heavy_check_mark:     |                         |\n| `\\|`     |                    |                        | :heavy_check_mark:      |\n| `\\|\\|`   |                    | :heavy_check_mark:     |                         |\n| `\\|\\|\\|` |                    | :heavy_check_mark:     |                         |\n| `=`      |                    |                        | :heavy_check_mark:      |\n| `=~`     |                    | :heavy_check_mark:     |                         |\n| `==`     |                    | :heavy_check_mark:     |                         |\n| `===`    |                    | :heavy_check_mark:     |                         |\n| `!=`     |                    | :heavy_check_mark:     |                         |\n| `!==`    |                    | :heavy_check_mark:     |                         |\n| `\u003c`      |                    | :heavy_check_mark:     |                         |\n| `\u003e`      |                    | :heavy_check_mark:     |                         |\n| `\u003c\u003e`     |                    |                        | :heavy_check_mark:      |\n| `\u003c=`     |                    | :heavy_check_mark:     |                         |\n| `\u003e=`     |                    | :heavy_check_mark:     |                         |\n| `\\|\u003e`    |                    | :heavy_check_mark:     |                         |\n| `\u003c\\|\u003e`   |                    | :heavy_check_mark:     |                         |\n| `\u003c~\u003e`    |                    | :heavy_check_mark:     |                         |\n| `~\u003e`     |                    | :heavy_check_mark:     |                         |\n| `~\u003e\u003e`    |                    | :heavy_check_mark:     |                         |\n| `\u003e\u003e\u003e`    |                    | :heavy_check_mark:     |                         |\n| `\u003c~`     |                    | :heavy_check_mark:     |                         |\n| `\u003c\u003c~`    |                    | :heavy_check_mark:     |                         |\n| `\u003c\u003c\u003c`    |                    | :heavy_check_mark:     |                         |\n| `when`   |                    |                        | :heavy_check_mark:      |\n| `in`     |                    | :heavy_check_mark:     |                         |\n| `and`    |                    | :heavy_check_mark:     |                         |\n| `or`     |                    | :heavy_check_mark:     |                         |\n| `not`    |                    | :heavy_check_mark:     |                         |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwitchcrafters%2Foperator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwitchcrafters%2Foperator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwitchcrafters%2Foperator/lists"}