Description #
LiveScript is a functional programming language that compiles to JavaScript, designed as a more expressive, feature-rich alternative to CoffeeScript with influences from Haskell and F#.
History #
LiveScript was introduced in 2011 as a fork of CoffeeScript by George Zahariev, with the goal of fixing CoffeeScript’s limitations and adding functional programming capabilities. Though niche, it found a following among developers who preferred concise syntax and advanced language features in JavaScript environments.
Hello World Code #
console.log 'Hello, World!'
How to Run #
Option 1: Online
https://livescript.net/#try
Option 2: Local
Install via npm:
npm install -g LiveScript
Create a file hello.ls
:
console.log 'Hello, World!'
Then run:
lsc hello.ls
Key Concepts #
- Compiles to JavaScript
- Indentation-based, whitespace-sensitive
- Supports pattern matching
- Strong functional programming features
- Arrow functions:
->
and=>
- List comprehensions and ranges
- Optional parentheses and semicolons
- Macros and pipe operator (
|>
) - Influenced by Haskell, F#, and CoffeeScript
- Compatible with Node.js and the browser
Try It Online #
Fun Facts #
- Despite the name, LiveScript is not related to the original JavaScript name (which was once called LiveScript).
- It was one of the first compile-to-JS languages to adopt the pipe operator (
|>
) years before JavaScript proposals. - Though less popular now, LiveScript’s influence lives on in the JavaScript functional programming ecosystem.
Resources #
Official Site
GitHub Repository
Language Reference
LiveScript Examples