You can edit almost every page by Creating an account and confirming your email.

Gleam (programming language)

From EverybodyWiki Bios & Wiki

Gleam
File:Gleam Lucy.png
Lucy, the starfish mascot for Gleam[1]
ParadigmMulti-paradigm: functional, concurrent[2]
Designed byLouis Pilfold
DeveloperLouis Pilfold
First appearedJune 13, 2016; 9 years ago (2016-06-13)
Stable release
Lua error in Module:Wd at line 2189: attempt to index field 'wikibase' (a nil value). / Lua error in Module:Wd at line 2189: attempt to index field 'wikibase' (a nil value).
Typing disciplineType-safe, static, inferred[2]
Implementation languageRust
OSFreeBSD, Linux, macOS, OpenBSD, Windows[3]
LicenseApache License 2.0[4]
Filename extensions.gleam
Websitegleam.run
Influenced by
[5]

Search Gleam (programming language) on Amazon.

Gleam is a general-purpose, concurrent, functional high-level programming language that compiles to Erlang or JavaScript source code.[2][6][7]

Gleam is a statically-typed language,[8] which is different from the most popular languages that run on Erlang’s virtual machine BEAM, Erlang and Elixir. Gleam has its own type-safe implementation of OTP, Erlang's actor framework.[9] Packages are provided using the Hex package manager, and an index for finding packages written for Gleam is available.[10]

History

The first numbered version of Gleam was released on April 15, 2019.[11] Compiling to JavaScript was introduced with version v0.16.[12]

In 2023 the Erlang Ecosystem Foundation funded the creation of a course for learning Gleam on the learning platform Exercism.[13]

Version v1.0.0 was released on March 4, 2024.[14]

Features

Gleam includes the following features, many common to other functional programming languages:[7]

Example

A "Hello, World!" example:

import gleam/io

pub fn main() {
  io.println("hello, world!")
}

Gleam supports tail call optimization:[15]

pub fn factorial(x: Int) -> Int {
  // The public function calls the private tail recursive function
  factorial_loop(x, 1)
}

fn factorial_loop(x: Int, accumulator: Int) -> Int {
  case x {
    1 -> accumulator

    // The last thing this function does is call itself
    _ -> factorial_loop(x - 1, accumulator * x)
  }
}

Implementation

Gleam's toolchain is implemented in the Rust programming language.[16] The toolchain is a single native binary executable which contains the compiler, build tool, package manager, source code formatter, and language server. A WebAssembly binary containing the Gleam compiler is also available, enabling Gleam code to be compiled within a web browser.

References

  1. "gleam-lang/gleam Issues - New logo and mascot #2551". GitHub.
  2. 2.0 2.1 2.2 "Gleam Homepage". 2024.
  3. "Installing Gleam". 2024.
  4. "Gleam License File". GitHub. 5 December 2021.
  5. Pilfold, Louis (2024-02-07). "Gleam: Past, Present, Future!". Fosdem 2024 – via YouTube.
  6. Krill, Paul (5 March 2024). "Gleam language available in first stable release". InfoWorld. Retrieved 26 March 2024.
  7. 7.0 7.1 Eastman, David (2024-06-22). "Introduction to Gleam, a New Functional Programming Language". The New Stack. Retrieved 2024-07-29.
  8. De Simone, Sergio (16 March 2024). "Erlang-Runtime Statically-Typed Functional Language Gleam Reaches 1.0". InfoQ. Retrieved 26 March 2024.
  9. Getting to know Actors in Gleam - Raúl Chouza. Code BEAM America. 2024-03-27. Retrieved 2024-05-06 – via YouTube.
  10. "Introducing the Gleam package index – Gleam". gleam.run. Retrieved 2024-05-07.
  11. "Hello, Gleam! – Gleam". gleam.run. Retrieved 2024-05-06.
  12. "v0.16 - Gleam compiles to JavaScript! – Gleam". gleam.run. Retrieved 2024-05-07.
  13. Alistair, Woodman (December 2023). "Erlang Ecosystem Foundation Annual General Meeting 2023 Chair's Report".
  14. "Gleam version 1 – Gleam". gleam.run. Retrieved 2024-05-07.
  15. "Tail Calls". The Gleam Language Tour. Retrieved 26 March 2024.
  16. gleam-lang/gleam, Gleam, 2024-05-06, retrieved 2024-05-06

External links



This article "Gleam (programming language)" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:Gleam (programming language). Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.