Re: foreach vs for

2008-04-04 Thread Chas. Owens
On Fri, Apr 4, 2008 at 7:20 PM, Rob Dixon <[EMAIL PROTECTED]> wrote: > > Chas. Owens wrote: > > On Thu, Apr 3, 2008 at 8:37 PM, Rob Dixon <[EMAIL PROTECTED]> wrote: > > snip > >> > * Note, this is not real Huffman encoding, just Larry Wall's version > of it. snip > > from http://www.perl.com/

Re: foreach vs for

2008-04-04 Thread Rob Dixon
Chas. Owens wrote: > On Thu, Apr 3, 2008 at 8:37 PM, Rob Dixon <[EMAIL PROTECTED]> wrote: > snip >> > * Note, this is not real Huffman encoding, just Larry Wall's version of >> it. >> >> Huffman encoding is a compression algorithm, used in GIF files if I >> remember correctly. It's not relevant

Re: foreach vs for

2008-04-04 Thread Rob Dixon
yitzle wrote: > Huffman encoding is basically the idea that the more often a symbol is > used, the shorter it should be. Huffman Coding turns data into a binary sequence. It is an algorithm for data compression, not simply a notion, and isn't relevant outside that field (except perhaps philosphy).

Re: foreach vs for

2008-04-04 Thread Randal L. Schwartz
> "Rob" == Rob Dixon <[EMAIL PROTECTED]> writes: Rob> Although 'foreach' is more useful, I think it's it's far more likely Rob> that someone realized that the two could be distinguished by context and Rob> needn't have different symbols, so the two were made equivalent. That "someone" would b

Re: foreach vs for

2008-04-03 Thread yitzle
Huffman encoding is basically the idea that the more often a symbol is used, the shorter it should be. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: foreach vs for

2008-04-03 Thread Chas. Owens
On Thu, Apr 3, 2008 at 8:37 PM, Rob Dixon <[EMAIL PROTECTED]> wrote: snip > > * Note, this is not real Huffman encoding, just Larry Wall's version of it. > > Huffman encoding is a compression algorithm, used in GIF files if I > remember correctly. It's not relevant to human-readable text. If you

Re: foreach vs for

2008-04-03 Thread Rob Dixon
Chas. Owens wrote: > On Thu, Apr 3, 2008 at 8:19 PM, Rob Dixon <[EMAIL PROTECTED]> wrote: >> Chas. Owens wrote: >> > On Thu, Apr 3, 2008 at 7:29 PM, Ryan <[EMAIL PROTECTED]> wrote: >> >> I know they are both the same, I just want to know why we have both. >> > snip >> > >> > Because originally

Re: foreach vs for

2008-04-03 Thread Chas. Owens
On Thu, Apr 3, 2008 at 8:19 PM, Rob Dixon <[EMAIL PROTECTED]> wrote: > Chas. Owens wrote: > > On Thu, Apr 3, 2008 at 7:29 PM, Ryan <[EMAIL PROTECTED]> wrote: > >> I know they are both the same, I just want to know why we have both. > > snip > > > > Because originally they meant different thing

Re: foreach vs for

2008-04-03 Thread Rob Dixon
Chas. Owens wrote: > On Thu, Apr 3, 2008 at 7:29 PM, Ryan <[EMAIL PROTECTED]> wrote: >> I know they are both the same, I just want to know why we have both. > snip > > Because originally they meant different things. The for loop was a > c-style loop and the foreach loop was an iterator. Eventual

Re: foreach vs for

2008-04-03 Thread Chas. Owens
On Thu, Apr 3, 2008 at 7:29 PM, Ryan <[EMAIL PROTECTED]> wrote: > I know they are both the same, I just want to know why we have both. snip Because originally they meant different things. The for loop was a c-style loop and the foreach loop was an iterator. Eventually it was realized that the it