The topic of this article may not meet Wikipedia's general notability guideline. (March 2024) |
Gleam is a general-purpose, concurrent, functional high-level programming language that compiles to Erlang or JavaScript source code.[2][7]
Paradigm | Multi-paradigm: functional, concurrent[2] |
---|---|
Designed by | Louis Pilfold |
Developer | Louis Pilfold |
First appeared | June 13, 2016 |
Stable release | 1.1.0[3]
/ 16 April 2024 |
Typing discipline | Type-safe, static, inferred[2] |
Memory management | Garbage collected |
Implementation language | Rust |
OS | FreeBSD, Linux, macOS, OpenBSD, Windows[4] |
License | Apache License 2.0[5] |
Filename extensions | .gleam |
Website | gleam |
Influenced by | |
[6] |
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.
Example edit
import gleam/io
pub fn main() {
io.println("hello, friend!")
}
Gleam supports tail call optimization:[9]
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)
}
}
References edit
- ^ "gleam-lang/gleam Issues - New logo and mascot #2551". GitHub.
- ^ a b c "Gleam Homepage". 2024.
- ^ "Release 1.1.0". April 16, 2024. Retrieved April 23, 2024.
- ^ "Installing Gleam". 2024.
- ^ "Gleam License File". GitHub. December 5, 2021.
- ^ "Gleam: Past, Present, Future! • Louis Pilfold @ FOSDEM 2024". YouTube. 2024.
- ^ Krill, Paul (March 5, 2024). "Gleam language available in first stable release". InfoWorld. Retrieved March 26, 2024.
- ^ De Simone, Sergio (March 16, 2024). "Erlang-Runtime Statically-Typed Functional Language Gleam Reaches 1.0". InfoQ. Retrieved March 26, 2024.
- ^ "Tail Calls". The Gleam Language Tour. Retrieved March 26, 2024.
External links edit