# Huffman coding comparison

Philippe Sigaud philippe.sigaud at gmail.com
Sun May 30 09:48:17 PDT 2010

```On Sun, May 30, 2010 at 18:00, Andrei Alexandrescu <
SeeWebsiteForEmail at erdani.org> wrote:

> On 05/30/2010 10:27 AM, Simen kjaeraas wrote:
>
>> { 2·x | x ∈ N, x² > 3 }
>> =>
>> ( list!"2*a" | iota(1,int.max) * where!"x^^2 > 3" )
>> return comp ! ("tuple(a,b,c)", "a*a+b*b==c*c && a<b")
>>
>

> This reminded me that Phobos lacks a combinatorial range, taking two or
>> more (forward) ranges and giving all combinations thereof
>>
>
Simen, could you please have a look at my dranges project?

http://www.dsource.org/projects/dranges/

Look at the algorithm and range sections, you'll find plenty of code that
try to tackle this.
In particular combinations() in algorithm2, and also tensorialProduct() in
rangeofranges

combinations is a higher-order range that takes any number of forward ranges
and output their combinations as tuples.

tensorialProduct does the same, but creates 'topology' : the combination of
three ranges is a range, whereas the tensorial product of three (linear)
ranges is a range of ranges of ranges:

tensorialProduct([0,1],[2,3])
->
[[(0,2),(0,3)],
[(1,2),(1,3)]]

(where (x,y) indicates a tuple)

Yah, that would be useful. If Philippe agrees to adapt his work, maybe that
> would be the fastest route. And don't forget - the gates of Phobos are open.
>
> Andrei
>
>
Concerning helping Phobos, I'd be delighted to if the Phobos team deems it
possible. It's just that my job and formation are far from coding (I'm more
a physicist), so I'm not sure my code would be up to it without being
reviewed.

I'm OK with pretty much everything concerning licensing and adaptation. I'll
begin by putting a Boost licence in my code, when dsource is up again. If
someone is interested by some of it, I'm quite ready to adapt it to conform
to D/Phobos evolutions. That's what I'm doing anyway.

Philippe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20100530/da9359ec/attachment.html>
```