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
2
votes
1 answer

How to make LiveScript scripts immediately .go() on seen?

(Note: I asked this question on https://github.com/gkz/LiveScript/issues/731 as well) When I use LiveScript in an html file directly, I have no way to run livescript code immediately on seen. For example; ...
ceremcem
  • 3,900
  • 4
  • 28
  • 66
2
votes
2 answers

Use prelude-ls with LiveScript

I just need to use prelude-ls library in LiveScript, but no from the REPL. In my little test, I have 4 files: main.htm application.ls application.js require.js I have the latest version of require.js (2.1.15) and in my main.htm I load the…
Marcelo Camargo
  • 2,240
  • 2
  • 22
  • 51
2
votes
1 answer

Should I completely eliminate try/catch from code where I use (Bluebird) promises?

I have a couple very basic setup steps before I call my promisified functions and I am considering wrapping them in a try/catch block because that seems the simplest way. However, it seems a little dirty to me. Should I instead make a function that…
Californian
  • 808
  • 1
  • 8
  • 15
2
votes
1 answer

Monad pattern on receiver

As I learn about monads after reading dozens of tutorials I'm trying to implement the pattern in JavaScript. I'm using LiveScript and Prelude to translate some Haskell monad examples. So the monad I'm trying to implement as an exercise is the List…
elclanrs
  • 92,861
  • 21
  • 134
  • 171
2
votes
1 answer

LiveScript - How do I use the backcall operator when there are multiple callbacks?

For example: $.get('/path/to/api').then( function(data) { alert( "$.get succeeded" ); }, function(error) { alert( "$.get failed!" ); } ); Is it possible to apply the backcall operator on both callbacks?
gsklee
  • 4,774
  • 4
  • 39
  • 55
2
votes
1 answer

Convert CoffeeScript code to LiveScript?

I have this valid CoffeeScript and wish to convert it to LiveScript. Can someone explain why it fails to convert? Also to give a converted one? TodoCtrl = (scope) -> scope.addTodo = -> scope.todos.push text: scope.todoText done:…
Phil
  • 46,436
  • 33
  • 110
  • 175
1
vote
1 answer

How to write a closure in livescript?

How to write a closure in livescript for i from 1 to 10 cb = -> console.log i set-timeout cb, i*1000 to get 1 to 10 instead of ten times 10 ?
toka
  • 128
  • 7
1
vote
2 answers

for loop assigns same functon everytime in Livescript

I would expect "x's" results, "y's" results and "z's" results be the same: In Livescript: x = a: -> 3 b: -> 4 y = {} for k, v of x console.log "key: ", k, "val: ", v y[k] = -> v.call this console.log "y is: ", y console.log "x's:…
ceremcem
  • 3,900
  • 4
  • 28
  • 66
1
vote
1 answer

Trying to understand Maybe Monads using LiveScript

I am trying to understand monads better. Is this minimal implementation of a Maybe Monad Correct ? Maybe = (value) -> @value = value Maybe.prototype.ret = -> @value Maybe.prototype.bind = (fn) -> if not (@value is null) return…
sourcevault
  • 313
  • 1
  • 3
  • 10
1
vote
1 answer

What is a nice Emacs Livescript mode?

I switched to Livescript for some tasks with success, however I didn't find a basic emacs mode for it. I'd like one with at least good indentation support. I found: livescript-mode, the one pointed by the official doc. It only converts the current…
Ehvince
  • 17,274
  • 7
  • 58
  • 79
1
vote
2 answers

Compile LiveScript that imports other js files

I'm probably misunderstanding how LiveScript works, but how should I import another js file in an .ls file and make it compile? For instance I'd like to access the DOM document like: el = document.getElementById 'app' and load mithril.js (which is…
Berco Beute
  • 1,115
  • 15
  • 30
1
vote
1 answer

Can I execute two Livescript (Coffeescript-fork) applications with single globally installed package?

I am running an application that is built with LiveScript, which is a fork of a fork of Coffeescript. You can execute files using the lsc command, ie $ lsc app.ls However, in the recent update, the way modules are required changes, ie require!{…
Anthony
  • 13,434
  • 14
  • 60
  • 80
1
vote
1 answer

How to hack LiveScript in order to link a separate file in html

We could include separate coffee-script file in html with: But if we want to use LiveScript in browser, they say: If you use this, your LiveScript scripts must be inline (not…
ceremcem
  • 3,900
  • 4
  • 28
  • 66
1
vote
1 answer

Get minimum of a object

Firstly, good morning. PreludeLS is able to get the minimum value of an array: [1 2 3 4 5 6 7 8 9 10] |> minimum #=> 1 Now I figure out a way to get the minimum-by a unknown key. Let's suppose I have an object called A and it has 3 properties with…
Marcelo Camargo
  • 2,240
  • 2
  • 22
  • 51
1
vote
1 answer

How to use module prelude-ls in TypeScript

I program in LiveScript and use the external module prelude-ls to do things as chaining, mapping, folding, grep or other functional concepts. In LiveScript, I can do _ = require 'prelude-ls' [1 2 3] |> map (*2) |> filter (> 4) |> fold (+) But if I…
Marcelo Camargo
  • 2,240
  • 2
  • 22
  • 51