Questions tagged [livescript]

LiveScript is a language which compiles to JavaScript. It is a fork of Coco which is in turn derived from CoffeeScript.

LiveScript is a language which compiles to JavaScript. It is a fork of Coco which is in turn derived from CoffeeScript. Like those two it has a relatively straightforward mapping to JavaScript. LiveScript is Coco but much more compatible with CoffeeScript, more functional, and more feature rich. LiveScript aims for increased expressiveness and code beauty. While adding features to assist in functional style programming, LiveScript also deeply supports imperative and object oriented programming, and has an optional class system with inheritance, calls to super, and more.

Official livescript site: http://livescript.net

67 questions
14
votes
3 answers

Functional javascript?

I'd like to use a "javascript derived language" in order to learn and use some of the usual web technologies today like node.js, jquery, etc. After toying for a while with functional concepts and languages, mostly F#, I'm looking if there's any…
11
votes
2 answers

Why does LiveScript use 'void 8' for undefined values?

I have been using LiveScript for quite a while now, and I have noticed that in situations where undefined would be implicitly returned, the expression void 8 is used instead. Naturally, I understand the use of void, but I cannot figure out why…
Jim O'Brien
  • 2,512
  • 18
  • 29
6
votes
1 answer

How can one include another LiveScript file in LiveScript?

How can one use code in a LiveScript file from another LS file? For example: # In script-one.ls foo = 5 # In script-two.ls bar = -> foo + 3 Simply including both files in the HTML via script tags does not seem to work. Changing the first script to…
Lokkij
  • 424
  • 4
  • 15
6
votes
2 answers

How to resize a canvas without anti-aliasing?

Update It's definitely to do with how I'm rescaling the canvas. If I draw the same scene onto a canvas and I don't change it's width and height to fill the screen, it works perfectly. What is the correct way to resize a canvas for fullscreen…
Dan Prince
  • 29,491
  • 13
  • 89
  • 120
4
votes
1 answer

Installing livescript and prelude-ls with npm and a gulpfile - is there no prelude-browser?

I have installed and used livescript and its prelude-ls library with bower successfully. I loaded prelude-browser-min.js: // gulpfile 'static/bower_components/prelude-ls/browser/prelude-browser-min.js', and I was able to import functions in my…
Ehvince
  • 17,274
  • 7
  • 58
  • 79
4
votes
1 answer

What's the point of the back piping operator

LiveScript features both the forward and backward piping operator. The purpose of the forward piping is clear: [1, 2, 3] |> reverse |> tail |> sum translates to and is much clearer than sum(tail(reverse([1, 2, 3])));. However, the purpose of the…
Lokkij
  • 424
  • 4
  • 15
4
votes
6 answers

What is a functional-style replacement for this loop?

nums = [2 5 3 7] result = [] result.push {x:nums[0]} for n in nums.slice(1) result.push {n:n + result[-1].x} log result # [{x:2} {x:7} {x:10} {x:17}] This is hard to express functionally using the function map because each element depends on…
MaiaVictor
  • 51,090
  • 44
  • 144
  • 286
3
votes
0 answers

How to add watch for dashed variable names in Google Chrome Debugger?

How can we easily add dashed variable names (they are written in Livescript) into watch window in Chrome (Chromium) debugger? Right-click adds the variable as is, so it can not be recognized as a variable:
ceremcem
  • 3,900
  • 4
  • 28
  • 66
3
votes
3 answers

jQuery events stop working with RxJS

So, basically, my problem is that at the start of my program, the jQuery .css() works just fine, tested by this: $("#canvas").css("border", "3px solid red"); Just after that, when I try to add a div - which does indeed get added whenever it is…
seequ
  • 456
  • 2
  • 13
3
votes
1 answer

What is the syntax for a section of the binding access operator?

I want to create a function that takes an object and returns a bound method, like this: f = (~ m) f(x)() # same as x.m() However, this parses ~ as the unary bitwise NOT operator, rather than the binding access operator. IOW it compiles to ~change.…
user1804599
3
votes
1 answer

What is the best way to export functions from a LiveScript module?

with LiveScript, when you write some code in a file, the default compiler wraps the compiled code in an anonymous function : Compiling this: add10 = -> it + 10 gives that: (function(){ var add10; add10 = function(it){ return it + 10; …
lud
  • 1,941
  • 20
  • 35
3
votes
1 answer

How to ignore return result

for example child.stdout.on \data (buffer) -> result.stdout += buffer --> child.stdout.on('data', function(buffer){ return result.stdout += buffer; }); and I need it without return. In F# I can add |> ignore how can I handle it in…
cnd
  • 32,616
  • 62
  • 183
  • 313
2
votes
1 answer

How to pass arguments automatically in LiveScript

How I can simplify line 3 (onChange property): Input do name: \input onChange: (event, value) ~> @limitInput { type: \string }, event, value
Developia
  • 3,928
  • 1
  • 28
  • 43
2
votes
2 answers

Jasmine tests in Livescript: "it" keyword conflict

I'm trying to port some Jasmine tests from javascript to LiveScript. One of Jasmine's functions is it. Here's an example: (function(){ describe("The selling page", function() { // bla bla it("should display cards.", function() { …
Ehvince
  • 17,274
  • 7
  • 58
  • 79
2
votes
1 answer

LiveScript equivalent to fat arrow syntax in CoffeeScript or ES6

The => in CoffeeScript or ES6 is often useful for binding this to a function, especially in callbacks. I can't seem to find an alternative in LiveScript. Does it exist?
Chris Fritz
  • 1,922
  • 1
  • 19
  • 23
1
2 3 4 5