3 ms·
I agree that using functional style was not fair (comment edited :)). By the way, here's a non contrived CS example directly from CS's source which I find reall
by olalonde 13y ago
I agree that using functional style was not fair (comment edited :)). By the way, here's a non contrived CS example directly from CS's source which I find really hard to understand: https://github.com/jashkenas/coffee-script/blob/master/src/grammar.coffee#L612 https://github.com/jashkenas/coffee-script/blob/master/src/g...
tokens = []
for name, alternatives of grammar
grammar[name] = for alt in alternatives
for token in alt[0].split ' '
tokens.push token unless grammar[token]
alt[1] = "return #{alt[1]}" if name is 'Root'
alt
Why is a loop assigned to a variable? I understand that loops are expressions but the intent here is not immediately clear and definitely requires some thinking. That's what I mean by readability (terseness is another thing).