Live data from Hacker News

Fargo: new Scheme-like language working in Node.js/browser

fargo.jcoglan.com

1–10 of 37 posts

Re: Fargo: new Scheme-like language working in Node.js/browser

#5
Well, TCO seems to work:

    (define (count x)
      (let loop ((x x) (sum 0))
        (if (zero ? x)
          sum
          (loop  (- x 1) (+ sum x)))))
    
    (count 100000) ; ==> 5000050000 (doesn't blow up)
I'm very tempted to help out however I can. I've been dreaming of using Scheme instead of JS in a Node.js setting.

Re: Fargo: new Scheme-like language working in Node.js/browser

#6
post #3
post #2

> (+ 1 1 1 1) => 2 > (* 3 4 5 6) => 12 Does it only consider the first and second items in a list?

So it would seem: https://github.com/jcoglan/fargo/blob/master/source/fargo/li...

Man, I forget how nice it is to be able to look into the source of stuff.

Other than being obviously new, this is pretty cool.

Edit: Would there be a better way to fix it than to add functions like this?

  function adder() {
    var args = Array.prototype.slice.call(arguments);
    return args.reduce(function(a, b){return a + b})
  }

  function subtractor() {
    var args = Array.prototype.slice.call(arguments);
    return args.reduce(function(a, b){return a - b})
  }

  function multiplier() {
    var args = Array.prototype.slice.call(arguments);
    return args.reduce(function(a, b){return a * b})
  }

  function divider() {
    var args = Array.prototype.slice.call(arguments);
    return args.reduce(function(a, b){return a / b})
  }
(I haven't really put too much thought into this, but would love to hear of stronger approaches or obvious bad ideas in this one)

Re: Fargo: new Scheme-like language working in Node.js/browser

#7
post #6
post #3

Earlier quoted context omitted.

So it would seem: https://github.com/jcoglan/fargo/blob/master/source/fargo/li...

Man, I forget how nice it is to be able to look into the source of stuff. Other than being obviously new, this is pretty cool. Edit: Would there be a better way to fix it than to add functions like this? function adder() { var args = Array.prototype.slice.call(arguments); return args.reduce(function(a, b){return a + b}) } function subtractor() { var args = Array.prototype.slice.call(arguments); return args.reduce(fun…

In principle that is a nice way to do it, and given that reduce is implemented natively on some platforms it might even be sufficiently performant, but to be honest I'd probably just write them as loops mutating a local variable. A language runtime is one of the places where a little bit of readability can be sacrificed for performance (although of course, one should measure it to make sure the gains are worth the cost).

Someone has actually already submitted a pull request doing just this:

https://github.com/jcoglan/fargo/pull/3

Re: Fargo: new Scheme-like language working in Node.js/browser

#10
Isn't Shen a very similar idea? Bringing functional programming to Javascript.

It is expected to be released very soon for Javascript (and Scheme).

[1]: http://news.ycombinator.com/item?id=1921347

[2]: https://groups.google.com/group/qilang/msg/bd474d815479b50a?...

Post reply on HN