{"id":19787944,"url":"https://github.com/i2y/jet","last_synced_at":"2025-05-01T00:30:31.457Z","repository":{"id":56717847,"uuid":"56563353","full_name":"i2y/jet","owner":"i2y","description":"Jet is a simple OOP, dynamically typed, functional language that runs on the Erlang virtual machine (BEAM). Jet's syntax is Ruby-like syntax.","archived":false,"fork":false,"pushed_at":"2017-09-10T20:28:04.000Z","size":192,"stargazers_count":24,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-21T09:33:05.642Z","etag":null,"topics":["beam","concurrent-programming","distributed-computing","erlang","jet","oop","programming-language","ruby"],"latest_commit_sha":null,"homepage":"","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/i2y.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}},"created_at":"2016-04-19T03:59:11.000Z","updated_at":"2023-12-16T15:53:29.000Z","dependencies_parsed_at":"2022-08-16T00:10:30.790Z","dependency_job_id":null,"html_url":"https://github.com/i2y/jet","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/i2y%2Fjet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i2y%2Fjet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i2y%2Fjet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i2y%2Fjet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/i2y","download_url":"https://codeload.github.com/i2y/jet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224228283,"owners_count":17276970,"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":["beam","concurrent-programming","distributed-computing","erlang","jet","oop","programming-language","ruby"],"created_at":"2024-11-12T06:25:17.764Z","updated_at":"2024-11-12T06:25:18.371Z","avatar_url":"https://github.com/i2y.png","language":"Elixir","readme":"\u003cimg src=\"https://github.com/i2y/jet/raw/master/jet_logo.png\" width=\"300px\"/\u003e\n\n\u003e \"I thought of objects being like biological cells and/or individual\n\u003e computers on a network, only able to communicate with messages\"\n\u003e _--Alan Kay, creator of Smalltalk, on the meaning of \"object oriented programming\"_\n\nJet is a simple OOP, dynamically typed, functional language that runs on the [Erlang](http://www.erlang.org) virtual machine (BEAM).\nJet's syntax is [Ruby](https://www.ruby-lang.org)-like syntax.\nJet was inspired by [Reia](https://github.com/tarcieri/reia) and [Celluloid](https://github.com/celluloid/celluloid).\n\n## Language features\n### Builtin Types\n```ruby\n### Numbers\n\n49  # integer\n4.9 # float\n\n### Booleans\n\ntrue\nfalse\n\n### Atoms\n\n:foo\n\n### Lists\n\nlist = [2, 3, 4]\nlist2 = [1, *list] # =\u003e [1, 2, 3, 4]\n[1, 2, 3, *rest] = list2\nrest # =\u003e [4]\n\nlist.append(5) # =\u003e [2, 3, 4, 5]\nlist # =\u003e [2, 3, 4]\n\n\nlist.select {|item| item \u003e 2}\n    .map {|item| item * 2} # =\u003e [6, 8]\nlist # =\u003e [2, 3, 4]\n\n# list comprehensions\n[n * 2 for n in list] # =\u003e [4, 6, 8]\n\n### Tuples\n\ntuple = {1, 2, 3}\ntuple.select {|item| item \u003e 1}\n     .map {|item| item * 2} # =\u003e [4, 6]\n\ntuple.to_list # =\u003e [1, 2, 3]\n\n\n### Maps\n\ndict = {foo: 1, bar: 2}\ndict2 = dict.put(:baz, 3) # =\u003e {foo: 1, bar: 2, baz: 3}\ndict # =\u003e {foo: 1, bar: 2}\ndict.get(:baz, 100) # =\u003e 100\n\n### Strings (Lists)\n\n\"Abc\"\n\n\n### Anonymous functions (Blocks)\n\nadd = {|x, y| x + y}\nadd(40, 9) # =\u003e 49\n\nmultiply = do |x, y|\n  x * y\nend\n\nmultiply(7, 7) # =\u003e 49\n\n\n### Binaries\n\n\u003c\u003c1, 2, 3\u003e\u003e\n\u003c\u003c\"abc\"\u003e\u003e\n\u003c\u003c1 , 2, x\u003e\u003e = \u003c\u003c1, 2, 3\u003e\u003e\nx # =\u003e 3\n\n```\n\n### Class definition\nCar.jet\n```ruby\nModule Car\n  class Car\n    # On jet, state of an instance is immutable.\n    # The initialize method returns initial state of an instance.\n    def initialize()\n      {name: \"foo\",\n       speed: 100}\n    end\n  \n    def display()\n      @name.display()\n      @speed.display()\n    end\n end\nend\n```\n\n### Module definition\nEnumerable.jet\n```ruby\nmodule Enumerable\n  def select(func)\n    reduce([]) {|item, acc|\n      if func.(item)\n        acc ++ [item]\n      else\n        acc\n      end\n    }\n  end\n\n  def filter(func)\n    reduce([]) {|item, acc|\n      if func.(item)\n        acc ++ [item]\n      else\n        acc\n      end\n    }\n  end\n\n  def reject(func)\n    reduce([]) {|item, acc|\n      if func.(item)\n        acc\n      else\n        acc ++ [item]\n      end\n    }\n  end\n\n  def map(func)\n    reduce([]) {|item, acc|\n      acc ++ [func.(item)]\n    }\n  end\n\n  def collect(func)\n    reduce([]) {|item, acc|\n      acc ++ [func.(item)]\n    }\n  end\n\n  def min(func)\n    reduce(:infinity) {|item, acc|\n      match func.(acc, item)\n        case -1\n          0\n        case 0\n          0\n        case 1\n          item\n      end\n    }\n  end\n\n  def min()\n    reduce(:infinity) {|item, acc|\n      if acc \u003c= item\n        acc\n      else\n        item\n      end\n    }\n  end\n\n  def unique()\n    reduce([]) {|item, acc|\n      if acc.index_of(item)\n        acc\n      else\n        acc ++ [item]\n      end\n    }\n  end\n\n  def each(func)\n    reduce([]) {|item, acc|\n      func.(item)\n    }\n  end\nend\n```\n\n### Mixing in Modules\nSampleList.jet\n```ruby\nmodule SampleList\n  class SampleList\n    include Enumerable\n  \n    def initialize(items)\n      {items: items}\n    end\n  \n    def reduce(acc, func)\n      lists::foldl(func, acc, @items)\n    end\n  end\nend\n```\n\n### Trailing closures (Trailing blocks)\n```ruby\nsample_list = SampleList::SampleList.new([1, 2, 3])\nsample_list.select {|item| item \u003e 1}\n           .map {|item| item * 2}\n           # =\u003e [4, 6]\n```\n\n### Other supported features\n- Tail recursion optimization\n- Pattern matching\n\n### Currently unsupported features\n- Class inheritance\n- Macro definition\n\n## Requirements\n- Erlang/OTP \u003e= 18.0\n- Elixir \u003e= 1.1\n\n## Installation\n```sh\n$ git clone https://github.com/i2y/jet.git\n$ cd jet\n$ mix archive.build\n$ mix archive.install\n$ mix escript.build\n$ cp jet \u003cany path\u003e\n```\n\n## Usage\n### Command\nCompiling:\n```sh\n$ ls\nFoo.jet\n$ jet Foo.jet\n$ ls\nFoo.beam Foo.jet\n```\n\nCompiling and Executing:\n```sh\n$ cat Foo.jet\nmodule Foo\n  def self.bar()\n    123.display()\n  end\nend\n$ jet -r Foo::bar Foo.jet\n123\n```\n\n### Mix\nmix.exs file example:\n```elixir\ndefmodule MyApp.Mixfile do\n  use Mix.Project\n\n  def project do\n    [app: :my_app,\n     version: \"1.0.0\",\n     compilers: [:jet|Mix.compilers],\n     deps: [{:jet, git: \"https://github.com/i2y/jet.git\"}]]\n  end\nend\n```\n\".jet\" files in source directory(src) is automatically compiled by mix command.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fi2y%2Fjet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fi2y%2Fjet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fi2y%2Fjet/lists"}