News for hackers. Stuff that matters.
Re:Genetic Algorithms in CoffeeScript by Destroyer661 on Sunday September 23, 2012 @09:47AM (#4560918)
I'm not saying that it being your main language is bad, it's just the syntax is absolutely terrible to read and understand for those of us on C-style languages. If the point was to teach others, the vast majority of your audience is not going to be reading coffeescript and learning much.
Re:Genetic Algorithms in CoffeeScript by jeswin on Sunday September 23, 2012 @11:08AM (#4561095)
IMHO, I don't think it is fair to suggest this.

- There are GA tutorials available in several other languages, if this doesn't work for you. Btw, if a tutorial was offered in Lisp/Haskell, would we see the same suggestion?

- For Ruby/Python programmers, this isn't hard at all to read. Familiarity with non C-style languages might be something to pick up.

- Having moved to Coffee from C-style languages, I prefer coffee. But that is just my opinion.

I think HNers should be more tolerant of language choices. That argument can't really be won.

Re:Genetic Algorithms in CoffeeScript by phpnode on Sunday September 23, 2012 @01:41PM (#4561485)
that's funny because coffeescript is meant to be all about readability in code. I wonder if you really tried to read this or if you just commented based on the title. If you did really read it, I wonder if you found it hard to read because your opinion is tainted by those C style languages? It's not scientific of course but I just got my non coder, non technical girlfriend to read through both the coffeescript and javascript versions of this and I definitely had to explain a lot less to her with the coffeescript version, she says it's easier to read because it's structured more like plain English.
Re:Genetic Algorithms in CoffeeScript by jashkenas on Sunday September 23, 2012 @01:52PM (#4561521)
Hurrah. That's a big part of the entire premise.
Re:Genetic Algorithms in CoffeeScript by tinco on Sunday September 23, 2012 @09:59AM (#4560945)
In all code examples you can press the down arrow to view the horrible (c-style) Javascript source.

The javascript seems to be mainly horrible because of the coffeescript code being object oriented and its lack of a more powerful looping construct.

Re:Genetic Algorithms in CoffeeScript by ville on Sunday September 23, 2012 @05:07PM (#4562049)
It looks like there is something missing in the first example in Javascript.

Population = (function() { Population.prototype.genomes = []; })();

This throws a ReferenceError because Population is not defined.

Genome = (function() {

  Genome.prototype.values = [];

  function Genome(values) {
    this.values = values != null ? values : this.initial();
  }

  Genome.prototype.inital = function(){
    return [RANDOMARRAY FROM [0-14]]
  }
})();

After this part Genome will be undefined.

Re:Genetic Algorithms in CoffeeScript by janmonschke on Sunday September 23, 2012 @06:45PM (#4562360)
Thx, forgot to copy the var statements. It's fixed now.