4 ms·
Why can't we have the expressiveness of CL or Haskell with the performance of C++?
by capisce 14y ago
Why can't we have the expressiveness of CL or Haskell with the performance of C++?
- jeremiep 14y agoWe do, its called the D programming language.
- shadowfox 14y agoThat feels a little surprising to me. Last time I looked at D it was nowhere close to CL or Haskell in expressiveness? (It was certainly better than C and less complicated than C++). Has there been significant improvements in the past couple of years?
- CountHackulus 14y agoThere really has. D 1.0 has 20 days of life left, and D 2.0 is really amazing. It has the C++ idea of "it's only there if you want it" but taken to an amazing degree. Yes, it's a little more verbose than most FP languages, but honestly, if you're interested in verbosity, go use J or Coke. The thing I like about D is that there's no surprises, everything works the way you'd expect it to. You can guess at what code should look like, and chances are it'll work.
- Peaker 14y agomap (head &&& length) . sort . group filterM (const [True, False]) Can you show how you implement these in D? If you want, I can explain these or give other examples of expressiveness I don't think you'll find in D.
- deleted 14y ago[deleted]
- tel 14y agoThat is one of the best implementations of powerset I've seen in a while. Thank you for that!
- roryokane 14y agoLinks explaining these Haskell code snippets: http://stackoverflow.com/a/10410997/578288 http://stackoverflow.com/a/10410997/578288 – the `map` snippet converts a flat list into a multiset represented as a list of `(count, element)` tuples http://stackoverflow.com/a/5378799/578288 http://stackoverflow.com/a/5378799/578288 – the `filterM` snippet returns the powerset of its list argument (http://en.wikipedia.org/wiki/Power_set http://en.wikipedia.org/wiki/Power_set)
- orlandu63 14y agoI think you mean group . sort
- Peaker 14y agoOops, quick-typing on my phone can have problematic results :-)
- gtani 14y agoCan you detail, or point to background info? There've been type system debates between proponents of Haskell, ocaml, SML, scala, and F#, i've never seen a D to Haskell comparison, and I've never seen D mentioned as a "free theorems" language. Maybe in this vid: http://channel9.msdn.com/Blogs/Charles/Alexandrescu-Bright-Meijer-Moran-Pure-versus-Native-and-much-more http://channel9.msdn.com/Blogs/Charles/Alexandrescu-Bright-M... Here's a scala to haskell http://www.cs.ox.ac.uk/jeremy.gibbons/publications/scalagp.pdf http://www.cs.ox.ac.uk/jeremy.gibbons/publications/scalagp.p...
- roryokane 14y agoWe can, theoretically. We just haven't yet developed algorithms that are clever enough to make the correct optimizations to code in enough of the cases where such optimizations are possible. There are patterns in our code that we humans can write out when we write our code in C++, but that we haven't yet formalized and implemented for the computer to do.