3 ms·
map (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 ot
by Peaker 14y ago
map (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 :-)