$ whois gleam
Gleam
first released in 2016 · by Louis Pilfold
$ guessprog --inspect gleam
- year
- 2016
- paradigm
- functional
- family
- erlang
- memory
- automatic gc
- binding
- static
- safety
- strong
GLEAM(7)
- AUTHORS
- Louis Pilfold
- HISTORY
- Louis Pilfold started Gleam in 2016, wanting the reliability of the Erlang virtual machine with the safety of a modern static type system. Gleam compiles to Erlang, to run on the BEAM alongside Erlang and Elixir code, and also to JavaScript. Its compiler is written in Rust and the language is deliberately small: no null, no exceptions, no macros and no type classes. Version 1.0 was released in March 2024.
- USAGE
- A young but fast-growing language, popular with developers who like functional programming and the BEAM. It is used for web back ends and services, and its friendly community and error messages are often praised.
- SEE ALSO
- Gleam on Wikipedia ↗
import gleam/int
import gleam/io
import gleam/list
pub type Pet {
Dog(name: String)
Cat(name: String, lives: Int)
}
fn describe(pet: Pet) -> String {
case pet {
Dog(name) -> name <> " says woof"
Cat(name, lives) -> name <> " has " <> int.to_string(lives) <> " lives"
}
}
pub fn main() {
[Dog("Rex"), Cat("Tom", 9)]
|> list.map(describe)
|> list.each(io.println)
}