Gleam is a general-purpose, concurrent, functional high-level programming language that compiles to Erlang or JavaScript source code.
The topic of this article may not meet Wikipedia's general notability guideline. (March 2024) |
Paradigm | Multi-paradigm: functional, concurrent |
---|---|
Designed by | Louis Pilfold |
Developer | Louis Pilfold |
First appeared | June 13, 2016 |
Stable release | |
Typing discipline | Type-safe, static, inferred |
Memory management | Garbage collected |
Implementation language | Rust |
OS | FreeBSD, Linux, macOS, OpenBSD, Windows |
License | Apache License 2.0 |
Filename extensions | .gleam |
Website | gleam |
Influenced by | |
Gleam is a statically-typed language, which is different from the most popular languages that run on Erlang’s virtual machine BEAM, Erlang and Elixir.
import gleam/io pub fn main() { io.println("hello, friend!") }
Gleam supports tail call optimization:
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) } }
This article uses material from the Wikipedia English article Gleam (programming language), which is released under the Creative Commons Attribution-ShareAlike 3.0 license ("CC BY-SA 3.0"); additional terms may apply (view authors). Content is available under CC BY-SA 4.0 unless otherwise noted. Images, videos and audio are available under their respective licenses.
®Wikipedia is a registered trademark of the Wiki Foundation, Inc. Wiki English (DUHOCTRUNGQUOC.VN) is an independent company and has no affiliation with Wiki Foundation.