3 ms·
IMO expressiveness has to do with being close to natural language: "multiply number by 2 for every number in 1 to 10". "map" is CS vocabulary. The conditional
by ricardo_ 15y ago
IMO expressiveness has to do with being close to natural language: "multiply number by 2 for every number in 1 to 10". "map" is CS vocabulary.
The conditional could be placed outside the string and still be a one-liner. It's there mostly for "flow".
- adamtulinius 15y agohttp://en.wikipedia.org/wiki/Expressive_power http://en.wikipedia.org/wiki/Expressive_power "In computer science, the expressive power of a language describes the ideas expressible in that language." So, language expressiveness is about what can be expressed in a language, and not really about whether you type "multiply number by 2 for every number in 1 to 10" or use map, since that expresses the same thing.
- ricardobeat 15y ago"In computer science". I'm referring to expressiveness from a linguistics point of view - understanding an expression without depending on complex previously learned concepts. Also, I'm not a native English speaker so I might be using the wrong words to express myself.
- Argorak 15y agoI fail see how map is a difficult concept, despite being a word that needs to be learned. I do a lot of training for Ruby and usually introduce enumerable.rb first to all newbies. Usual reaction: "cool, I finally have a word for that". It gives programmers the ability to _express_ what action they are doing there, instead of leaving them free-floating in a for-loop-soup.
- ricardobeat 15y agoFor example, ask your parents about map, then the comprehension, which one will they be able to understand? It's about usability: the most ingenious programmer will be more efficient using a simpler, straight-forward interface as long as it accomplishes the task. You're a user of a language's interface/syntax. But we are drifting off here. I'll avoid using "expressive" the next time around :)
- deleted 15y ago[deleted]
- deleted 15y ago[deleted]
- Argorak 15y agoActually, both of my parents are programmers of the old school, so they even understand the difference between foldr and foldl. I am actually in favor of having both options, so we might be on the same page actually. What I am opposed to, is the notion of adding a positive label to the less specialized version and a negative to the other.
- deleted 15y ago[deleted]
- jessedhillon 15y ago> For example, ask your parents about map, Since when is that the standard for a programming language? Some tools are made for expert usage -- they require training and foreknowledge. Programming languages weren't made for your mom.
- thenduks 15y agoThe funny part is that your parents probably wont understand the comprehension either. Even if they were likely to, I prefer to leave things the way they are when the only reason to change it is "now my kid brother can do it!"
- ricardobeat 15y agoAm I on reddit? y u no read previous comments?
- BasDirks 15y agomap is an easy and powerful concept, but a comprehension resembles natural language better. I agree though that map is more _expressive_ (a more concise and comprehensive way of communicating).
- Argorak 15y agoIt actually doesn't express the same thing. Map has no necessary notion of ordering, although most of the time, it behaves like the for-loop.
- Argorak 15y agoWe are doing applied CS here, don't we? So lets express us in that language. Also, why do we accept a*2 then? This is short mathematical notation, also a specialized language. Every field evolves domain languages for a reason: it adds the benefit of naming actions instead of implicitly doing them. "Being close to natural language" is a red herring. You can try, you will never get there and you will loose any benefit of a domain language. Also, my point was that interpretations of expressiveness differ vastly, so we should stop claiming that something is more expressive then the other.
- rimantas 15y ago> We are doing applied CS here, don't we? Yes. And CoffeScript prefers comprehensions over the maps. From the docs: > Comprehensions should be able to handle most places > where you otherwise would use a loop, each/forEach, > map, or select/filter In this case I prefer that way also because it puts the main thing first.
- deleted 15y ago[deleted]