Re: [Jprogramming] zlib huffman coding

2014-09-10 Thread Joe Bogner
Here a few other links ... after reading through the RFC. Not sure if they help, but just sharing from my own research into assisting on this topic https://github.com/evegard/pngview/blob/master/huffman.c#L54 And a fork of the putty version with dynamic huffman coding: http://rc.quest.com/viewvc/

Re: [Jprogramming] zlib huffman coding

2014-09-10 Thread Raul Miller
Ah, good point. Here's another thing: +/ bits < #@> F hcodes A 31 In some cases the deflate codes have fewer bits than huffman coding. So the problem is finding the algorithm that was used to define bits - it's not the huffman coding algorithm. I guess I need to spend some time reading rfc

Re: [Jprogramming] zlib huffman coding

2014-09-10 Thread bill lam
It refered to A and F (not A1 and F1) in my first email. I sent you an email off-list that included attachments. Ср, 10 сен 2014, Raul Miller написал(а): > Something is wrong here: > >$bits > 286 >(0=bits)-:0=F1 > 0 >+/0=F1 > 9 >+/0=bits > 26 > > 0 bits should mean that that sy

Re: [Jprogramming] zlib huffman coding

2014-09-10 Thread Raul Miller
Something is wrong here: $bits 286 (0=bits)-:0=F1 0 +/0=F1 9 +/0=bits 26 0 bits should mean that that symbol is not represented. But there are only 9 such symbols in F1. -- Raul On Wed, Sep 10, 2014 at 11:09 PM, bill lam wrote: > I guess the description of the algorithm itself is

Re: [Jprogramming] zlib huffman coding

2014-09-10 Thread bill lam
I guess the description of the algorithm itself is correct, but it does not mention how to get the bits of each symbol. The bit lengths for classic and zlib huffman can be different. for testing, the bits for A from libz.so are ":&>_10<\bits 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 1

Re: [Jprogramming] zlib huffman coding

2014-09-10 Thread Raul Miller
I agree that there should not be any 2s. However, I think this means that there's something wrong with the description of the algorithm, or at least my understanding of it. I'll need some time to digest this. Thanks, -- Raul On Wed, Sep 10, 2014 at 9:39 PM, bill lam wrote: > pardon me of for

Re: [Jprogramming] zlib huffman coding

2014-09-10 Thread bill lam
pardon me of forgetting telling another cavaet. zlib huffman code is suboptimal so that bit length of code for each symbol can be longer than that in classic huffman. eg in my orignal data. 10{. ":@>F deflatecodes2 A 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Re: [Jprogramming] zlib huffman coding

2014-09-10 Thread Raul Miller
Oops, sorry about that. Try it this way: deflatecodes2=:4 :0 L=. #@> x hcodes y U=. 0,~.L R=. ;<@(({. >./@(>#])&U #1:)@{. <@:+"1-@{.{."1 #:@i.@#)/.~L R/:;(F1 deflatecodes2 A1 0 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 0 0 1 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 1 0 0 1 1 1 1 0 1 1 1 1

Re: [Jprogramming] Replace one item of a list

2014-09-10 Thread Linda Alvord
I get different results in jhs where none of the lines have an empty line. NB. Here 5#'' (5#'')*/i.5 ''*/i.5 '' NB. To here I actually always expected to have an empty line for each expression. Linda -Original Message- From: programming-boun...@forums.jsoftware.com [

Re: [Jprogramming] Replace one item of a list

2014-09-10 Thread Don Kelly
On 10/09/2014 4:43 PM, Don Kelly wrote: I get 5#'' (5#'')*/i.5 ''*/i.5 Apologies for the double spacing in the original reply. hope that this is better. Don Kelly -- For information about J forums see http://www.jsoftware.

Re: [Jprogramming] Replace one item of a list

2014-09-10 Thread Don Kelly
I get 5#'' (5#'')*/i.5 ''*/i.5 NOTE-. blank line using J802 Don Kelly On 10/09/2014 4:16 PM, Linda Alvord wrote: Dan, after your 4 series, I tried this. Also odd: NB. Begin here 5#'' (5#'')*/i.5 ''*/i.5 '' NB. Note the spacing betwe

Re: [Jprogramming] zlib huffman coding

2014-09-10 Thread bill lam
Thanks Joe, putty only use zlib static huffman for encoding so that it does not build any huffman dictionary table. The zlib static huffman code does not care about individual symbol's frequency, it just encode 0 to 286 into bits, see section 3.2.6. On Sep 11, 2014 1:26 AM, "Joe Bogner" wrote:

Re: [Jprogramming] Replace one item of a list

2014-09-10 Thread Dan Bron
What were you expecting? Please excuse typos; sent from a phone. > On Sep 10, 2014, at 7:16 PM, "Linda Alvord" wrote: > > Dan, after your 4 series, I tried this. Also odd: > > NB. Begin here > 5#'' > > (5#'')*/i.5 > ''*/i.5 > '' > > NB. Note the spacing between lines above > >

Re: [Jprogramming] zlib huffman coding

2014-09-10 Thread bill lam
sorry typo, because there are _7_ symbols in the 6 bit code. On Sep 11, 2014 7:26 AM, "bill lam" wrote: > for zlib, all huffman code of the same bit length are in sequential, > starting with a code an 0 bit in the end (even number), and no gaps in the > block (consecutive). the symbols of these

Re: [Jprogramming] zlib huffman coding

2014-09-10 Thread bill lam
for zlib, all huffman code of the same bit length are in sequential, starting with a code an 0 bit in the end (even number), and no gaps in the block (consecutive). the symbols of these block represented are sequential but not consecutive (possibly gaps). So the zlib huffman code is slightly less e

Re: [Jprogramming] Replace one item of a list

2014-09-10 Thread Linda Alvord
Dan, after your 4 series, I tried this. Also odd: NB. Begin here 5#'' (5#'')*/i.5 ''*/i.5 '' NB. Note the spacing between lines above Linda -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On Behalf

Re: [Jprogramming] Replace one item of a list

2014-09-10 Thread Joe Bogner
It seems like chat is fine to share things created with J (as I've done that before myself). Ideally we'd have the author or some other volunteer curate meaningful content into the wiki. If there's at least some positive response on chat then it would seem to indicate it's worthy of putting it on t

Re: [Jprogramming] Replace one item of a list

2014-09-10 Thread Raul Miller
I do not see a conflict here. Thanks, -- Raul On Wed, Sep 10, 2014 at 1:41 PM, Dan Bron wrote: > I'd be up for that. But probably a better medium is the Wiki, as art is > typically an iterative process? > > -Dan > > - Original Message --- > > Subject: Re: [Jprogramming] Repla

Re: [Jprogramming] Replace one item of a list

2014-09-10 Thread Dan Bron
I'd be up for that. But probably a better medium is the Wiki, as art is typically an iterative process? -Dan - Original Message --- Subject: Re: [Jprogramming] Replace one item of a list From: Raul Miller Date: Wed, 10 Sep 2014 13:27:51 -0400 To: Programming forum

Re: [Jprogramming] Replace one item of a list

2014-09-10 Thread Raul Miller
Product managers, in general, do not make their decisions on technical grounds, but on popularity grounds. That means we need to support people generating media - art (images and image manipulating tools), games (games themselves but also tools for working with the data used in games), music (soun

Re: [Jprogramming] zlib huffman coding

2014-09-10 Thread Joe Bogner
You've already likely considered this, but if it were me I would compare results to a working implementation. The one from putty seems pretty clean and standalone: https://raw.githubusercontent.com/grumpydev/PortablePuTTY/master/SSHZLIB.C . I was able to compile it on windows no problem and I assum

Re: [Jprogramming] Replace one item of a list

2014-09-10 Thread Jose Mario Quintana
I do not think the dictionary is wrong but perhaps it is incomplete. As you pointed out, the tally is 1 and the neutral element intance provision does not apply; so, for example, in the sentence (*/0) or in general (u/A) where A is an atom the result is the atom (A) (even if u is undefined!). Where

Re: [Jprogramming] zlib huffman coding

2014-09-10 Thread Raul Miller
I think the use of the term "consecutive" rather than "sequential" is telling. The described algorithm is: compute the huffman code lengths: #@>F1 hcodes A1 1 3 7 7 6 6 6 6 6 6 6 2 Then assign ascending huffman codes first in length order and then within codes of the same length. Taken litera

Re: [Jprogramming] Replace one item of a list

2014-09-10 Thread Dan Bron
Product managers, in general, aren't going to base their decisions on what some random internet stranger wrote on an obscure mailing list. More likely to influence their decision is the very fact that the primary mailing list for the language is obscure. In other words: if our goal is to get peopl

Re: [Jprogramming] Replace one item of a list

2014-09-10 Thread Ian Clark
Sorry, Dan -- none of that would work for me if I were a product manager. One with some control over which language to choose and to recruit my programmers for. Or more like it: which language to avoid. One sight of this thread and I'd say "toy language -- my staff will be spending all their time f

Re: [Jprogramming] Replace one item of a list

2014-09-10 Thread Dan Bron
Linda wrote: > *i.5 > 0 1 1 1 1 >*/"0 i.5 > 0 1 2 3 4 Joe wrote: > It looks like /"0 yields the right side without evaluating the left side > > asdfasdf/"0 i.5 > 0 1 2 3 4 > > I don't totally get it myself This boils down to foo/ scalar_value . Note that because of the "0 (meani

Re: [Jprogramming] Replace one item of a list

2014-09-10 Thread Joe Bogner
Great explanation Jan-Pieter. It makes perfect sense. Thank you On Wed, Sep 10, 2014 at 11:42 AM, Jan-Pieter Jacobs < janpieter.jac...@gmail.com> wrote: > I think the manual page on insert ( > http://www.jsoftware.com/help/dictionary/d420.htm ) sufficiently > explains this behavior: > > "0 makes

Re: [Jprogramming] Replace one item of a list

2014-09-10 Thread Jan-Pieter Jacobs
I think the manual page on insert ( http://www.jsoftware.com/help/dictionary/d420.htm ) sufficiently explains this behavior: "0 makes the function operate on scalars and, as per the Vocabulary on Insert (/) : " If y has no items (that is, 0=#y), the result of u/y is the neutral or identity elemen

Re: [Jprogramming] Replace one item of a list

2014-09-10 Thread Dan Bron
When I see a newcomer (not you, Ian, obviously) raise such concerns as "how do I do updates in place?", my typical response to this is: J is a function-level language. It expresses computations in terms of data flow. Verbs (functions) are primary; nouns (data) are secondary. STOP THINKING IN TE

Re: [Jprogramming] Replace one item of a list

2014-09-10 Thread Joe Bogner
On Wed, Sep 10, 2014 at 9:57 AM, Linda Alvord wrote: > > Here's the example that is puzzling me. > > *i.5 > 0 1 1 1 1 >*/"0 i.5 > 0 1 2 3 4 > > It looks like /"0 yields the right side without evaluating the left side asdfasdf/"0 i.5 0 1 2 3 4 This might be helpful in understanding: h

Re: [Jprogramming] Replace one item of a list

2014-09-10 Thread Ian Clark
>> Then it actually does in-place updating (even though, at face value, J syntax does not permit such a thing). > Please explain why this is not permitted by J syntax. My use of the word "permit" was misleading -- "suggest' might have been better. Roger is right to challenge me on that point. Wh

Re: [Jprogramming] Ragged Array Shapes are Trees

2014-09-10 Thread Thomas Costigliola
Bo, would you say that ordinal fractions are equivalent to "left lists" from the paper "From Trees Into Boxes"? If so, then J already addresses the nodes of a tree in that manner through {::, with the slight modification that data in a node can be an array of arbitrary shape so each step down the t

[Jprogramming] zlib huffman coding

2014-09-10 Thread bill lam
For huffman coding used in zlib: https://www.ietf.org/rfc/rfc1951.txt section 3.2.2. The Huffman codes used for each alphabet in the "deflate" format have two additional rules: * All codes of a given bit length have lexicographically consecutive values, in the same order as the symbols th

Re: [Jprogramming] Ragged Array Shapes are Trees

2014-09-10 Thread Dan Bron
I would be interested to see a model of arrays-and-trees-as-ordinal-fractions in J. With such things as indexing, catenation, etc. -Dan - Original Message --- Subject: Re: [Jprogramming] Ragged Array Shapes are Trees From: "'Bo Jacoby' via Programming" Date: Tue, 9 Sep 20

Re: [Jprogramming] Replace one item of a list

2014-09-10 Thread Linda Alvord
Roger, To explain f would you call } item amend rather than amend ? ]a=: 100 (2 4 5}) a=:i.10 0 1 100 3 100 100 6 7 8 9 f=: 13 :'x (2 4 5}) y' 100 f i.10 0 1 100 3 100 100 6 7 8 9 Here's the example that is puzzling me. *i.5 0 1 1 1 1 */"0 i.5 0 1 2 3 4 Linda -