🦔 YLC

YALCE / YLC (Yet Another Live-Coding Environment) is a functional programming language bundled with libraries for audio synthesis and OpenGL graphics.
YLC aims to be small, simple and performant, with a minimal set of features and seamless C interoperability

Key Features

Quick Start

Install via Homebrew (macOS)

brew install crawdaddie/yalce/yalce

Or build from source

git clone https://github.com/crawdaddie/yalce
cd yalce
./setup.sh
make

# replace the installation path below with anywhere you prefer that's on your $PATH
ln -s "$PWD/build/ylc" "$HOME/.local/bin/ylc"

Main Sections

Examples

Fibonacci with pattern matching

let fib = fn x ->
  match x with
  | 0 -> 0
  | 1 -> 1
  | _ -> (fib (x - 1)) + (fib (x - 2))
;;

try in repl

First-class functions

let list_rev = fn l ->
  let aux = fn l res ->
    match l with
    | [] -> res
    | x :: rest -> aux rest (x :: res)
  ;;
  aux l []
;;

let list_map = fn f l ->
  let aux = fn f l res -> 
    match l with
    | [] -> res
    | x :: rest -> aux f rest (f x :: res) 
  ;;
  aux f l [] |> list_rev
;;

let test = module () ->
  let test_map_plus = (list_map ((+) 1) [0,1,2,3]) == [1,2,3,4];
;