The topic of this article may not meet Wikipedia's general notability guideline. (October 2017) (Learn how and when to remove this template message)
This article relies too much on references to primary sources. (May 2015) (Learn how and when to remove this template message)
|Paradigm||multi-paradigm, functional, object-oriented|
|Designed by||Jeremy Ashkenas, Satoshi Murakami, George Zahariev|
|Developer||Jeremy Ashkenas, Satoshi Murakami, George Zahariev|
LiveScript 1.5.0 / 15 May 2016
|Typing discipline||dynamic, weak|
hello = -> console.log 'hello, world!'
While calling a function can be done with empty parens,
hello(), LiveScript treats the exclamation mark as a single-character shorthand for function calls with zero arguments:
LiveScript introduces a number of other incompatible idioms:
hello-world = -> console.log 'Hello, World!'
With this definition, both the following calls are valid. However, calling using the same dashed syntax is recommended.
Like a number of other functional programming languages such as F# and Elixir, LiveScript supports the pipe operator,
|> which passes the result of the expression on the left of the operator as an argument to the expression on the right of it. Note that in F# the argument passed is the last argument, while in Elixir it is the first.
"hello!" |> capitalize |> console.log # > Hello!
Operators as functions
When parenthesized, operators such as
+ can be included in pipelines or called as if they were functions.
111 |> (+) 222 # > 333 (+) 1 2 # > 3
|This programming-language-related article is a stub. You can help Wikipedia by expanding it.|