Friday, April 26, 2024

Gleam prog.language in Rust => Erlang, JavaScript

a new functional prog. lang...

no if statement, no (for) loops!


with the creator of the Gleam programming language; a functional programming language for building type-safe systems that compiles to Erlang and JavaScript and it’s written in Rust. 

...inspiration and development of Gleam, how it compares to other languages, where it shines, the overwhelming amount of support Louis is getting through GitHub sponsors, what’s next for Gleam and their near-term plans for a language server.


Gleam.run

"The power of a type system, the expressiveness of functional programming, and the reliability of the highly concurrent, fault tolerant Erlang runtime, with a familiar and modern syntax."

Gleam @GitHub, Apache2 license (github.com/gleam-lang/gleam)


lustre-labs/lustre @GitHub (MIT license)
✨ Make your frontend shine ✨
A framework for building Web apps in Gleam!

Sponsor Louis on GitHub Sponsors


import gleam/int
import gleam/io

pub fn main() {
  let x = int.random(5)
  io.debug(x)

  let result = case x {
    // Match specific values
    0 -> "Zero"
    1 -> "One"

    // Match any other value
    _ -> "Other"
  }
  io.debug(result)
}

Recursion in Gleam on Exercism

Gleam has no special syntax for looping, so all looping is done with recursion.

pub fn list_length(list: List(String)) -> Int {
  case list {
    [] -> 0
    [_, ..rest] -> 1 + list_length(rest)
  }
}

No comments: