4 ms·
Functional Programming in JavaScript using LiveScript and prelude.ls
- coenhyde 14y agoThis is fantastic! I love that it has currying and composing. I'm going to switch from CoffeeScript to LiveScript.
- petitmiam 14y agoLiveScript is an interesting choice of name. JavaScript was officially called LiveScript back in Netscape Navigator 2.0 beta.
- GeZe 14y agoYes, it's an inside joke for those who know JavaScript well.
- chii 14y agohave you heard of http://roy.brianmckenna.org/ http://roy.brianmckenna.org/ ? Its basically haskell in javascript.
- GeZe 14y agoYes, I am aware - it is an interesting project. However, it's a couple of steps farther away from JavaScript than I would want to work with.
- pufuwozu 14y agoAuthor of Roy here. Would love to hear more about how/where you think it's too far away from JavaScript. I'm trying to avoid that feeling :) brian@brianmckenna.org (also, I'm writing an untyped typeclassopedia for use in my compiler - I'll be releasing it soon - definitely feel that'd be a complement to prelude.ls)
- pdelgallego 14y agoHi Brian, I was looking forward to see your presentation in SpainJS next month, but I might not be able to make it. Is there any of your roy talks online or any gentle introduction to roy besides roy.brianmckenna.org?
- pufuwozu 14y agoYou can checkout my JSConf talk at: http://brianmckenna.org/files/presentations/jsconf-roy/ http://brianmckenna.org/files/presentations/jsconf-roy/ - hopefully the video will be posted soon I wrote an article about it for IEEE's Internet Computing magazine: http://brianmckenna.org/blog/roy_ieee http://brianmckenna.org/blog/roy_ieee I've also started writing an introduction but it has been shelved while I work on making the typesystem sound. Hopefully I'll see you at SpainJS if you make it :)
- GeZe 14y agoHi Brian, thanks for creating Roy, it's very cool! I've underlined LiveScript functional features in this blog post, but like JavaScript, LiveScript also supports imperative and object-oriented programming. One could port a JavaScript program to LiveScript with relative ease, as it's just syntax changes (with features added on top). I do not think that would be possible in Roy. For some people that's fine, but for my own projects I would prefer using something that maps more closely to JavaScript.
- adrusi 14y agowhile it's a great language, and I was a fan of coco for a while, my experience with coco was that it was like a ghost town and I was one of the only users.
- GeZe 14y agoCoco is amazing. To avoid becoming a "ghost town", I have made LiveScript much more compatible with CoffeeScript, easing transitions. I have invested time into making a decent website, and have now composed a couple of blog posts promoting LiveScript. Already several people have written projects in LiveScript: https://github.com/gkz/LiveScript/wiki/Projects-using-LiveScript https://github.com/gkz/LiveScript/wiki/Projects-using-LiveSc... I hope with my continued efforts that the scenario you describe can be avoided.
- egeozcan 14y agoI think what you did is great but a very important missing thing is syntax highlighting for ls files on GitHub. Maybe you can make a pull to their Linguist? https://github.com/github/linguist https://github.com/github/linguist
- jhickner 14y agoI really like the coffeescript + haskell feel. I always miss haskell's '$' for function application and '.' for composition. LiveScript has both (<| and .). Check out the "10 LiveScript one-liners to impress your friends" post. Great stuff: http://gkz.github.com/LiveScript/blog/livescript-one-liners-to-impress-your-friends.html http://gkz.github.com/LiveScript/blog/livescript-one-liners-...
- egeozcan 14y agoI'm a JavaScript fan and I'm impressed. Still feel like a bit overwhelmed with so many new ideas though. By the way, does LiveScript (the name really makes me smile and even giggle) support source maps? see http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/ http://www.html5rocks.com/en/tutorials/developertools/source... for more info
- riffraff 14y agowhy use map (-> it.length > x), list map (call \toUpperCase), 'haha' for functions with only one free variable? IMHO it would be prettier to have something like scala's _ map (_.length > x), list map (_.toUpperCase), 'haha' i.e. automatically build a closure when _ is used eithout the need for additional anonymous function syntax
- quarterto 14y agoThey discussed this, and decided: a) partially-applied operators fills some of the gap, and b) they're far too complicated to implement. https://github.com/gkz/LiveScript/issues/19 https://github.com/gkz/LiveScript/issues/19 https://github.com/taku0/placeholder_syntax_for_coffeescript/blob/master/src/placeholder.coffee https://github.com/taku0/placeholder_syntax_for_coffeescript...
- riffraff 14y agoah, thanks, I missed partially applied operators. But then, it seems easy to do it with single method calls too, e.g. map (.length) x rather than map (call \length) x does not fit more complex usage, but it's a tiny improvement I'd think
- GeZe 14y agoThis is an interesting idea - I will look into it. It does not seem to conflict with the current syntax. Thanks for the suggestion!
- adrusi 14y agoI'm not a big fan of scala's _ operator. I find it a poor decision from a language design perspective for _.method(param) to be a function, but for a.method(param) to not be a function (unless of course method returns a function) It also doesn't nest properly
- ne0codex 14y agoInteresting, but I strongly dislike the use of whitespace indentation for new statements/segments of code, it will get tedious when you are nesting multiple blocks of code. And I like it when Xcode highlights the brackets/parenthesis because it's just easier to pick up ( and ) and { and } from a line of text.
- wffurr 14y agoIf { Your { Code { Is { That { Nested { } } } } } } Then you at not using the functional programming constructs available to you and have poorly decomposed code. Deep nesting is a major code smell.