Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #1155 > unrolled thread
| Started by | "luser.droog" <luser.droog@gmail.com> |
|---|---|
| First post | 2012-12-08 14:02 -0600 |
| Last post | 2012-12-16 16:02 -0800 |
| Articles | 6 — 4 participants |
Back to article view | Back to comp.lang.postscript
golfing again "luser.droog" <luser.droog@gmail.com> - 2012-12-08 14:02 -0600
Re: golfing again zupftom@googlemail.com - 2012-12-08 13:51 -0800
Re: golfing again "luser.droog" <luser.droog@gmail.com> - 2012-12-08 19:18 -0600
Re: golfing again tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-12-09 00:54 -0500
47-char binary-name-string exec/Implicitly-named procedures (Re: golfing again) luser- -droog <mijoryx@yahoo.com> - 2012-12-16 15:58 -0800
Re: 47-char binary-name-string exec/Implicitly-named procedures (Re: golfing again) luser- -droog <mijoryx@yahoo.com> - 2012-12-16 16:02 -0800
| From | "luser.droog" <luser.droog@gmail.com> |
|---|---|
| Date | 2012-12-08 14:02 -0600 |
| Subject | golfing again |
| Message-ID | <ka06du$643$1@dont-email.me> |
I've been toying around with binary encodings and here are some results. The (mini-)goal is to shrink this sequence to read an input line from the source file: currentfile 999 string readline pop 35 chars A Binary Object Sequence starts with a four-byte header type length byte-length 129 5 ?? ?? Then an executable name type unused -1=systemname 32bit value 83 0 -1(16bits) 31 currentfile An integer is type unused lowbyte hibyte 01 0 999(16bits) So 4 + 6 (for the number) + 8 * 4 (names) = 42. Forget BOS! Binary Tokens are a little more promising, but limits to the first 255 system names. type val 146=x-sys-name 31=currentfile 135=LE-16b-int 999_10 = E7 03 146 165=string 146 125=readline 146 117=pop As a hex-string, <921F87E70392A5927D9275>cvx exec 32 chars. Not much. :(
[toc] | [next] | [standalone]
| From | zupftom@googlemail.com |
|---|---|
| Date | 2012-12-08 13:51 -0800 |
| Message-ID | <d9658ec7-bf33-46eb-b014-e5808ae3b1bb@googlegroups.com> |
| In reply to | #1155 |
Am Samstag, 8. Dezember 2012 21:02:51 UTC+1 schrieb luser- -droog: > I've been toying around with binary encodings and here are some results. > > > > The (mini-)goal is to shrink this sequence to read an input line from the > > source file: > > > > currentfile 999 string readline pop > > 35 chars > > > > A Binary Object Sequence starts with a four-byte header > > type length byte-length > > 129 5 ?? ?? > > > > Then an executable name > > type unused -1=systemname 32bit value > > 83 0 -1(16bits) 31 currentfile > > > > An integer is > > type unused lowbyte hibyte > > 01 0 999(16bits) > > > > So 4 + 6 (for the number) + 8 * 4 (names) = 42. Forget BOS! > > > > > > Binary Tokens are a little more promising, but limits to the first 255 > > system names. > > > > type val > > 146=x-sys-name 31=currentfile > > 135=LE-16b-int 999_10 = E7 03 > > 146 165=string > > 146 125=readline > > 146 117=pop > > > > As a hex-string, > > <921F87E70392A5927D9275>cvx exec > > 32 chars. > > > > Not much. :( You can shrink this to 11 bytes using binary token sequence in a real binary file. Hexdump: $ hexdump -C test.ps 00000000 92 1f 39 39 39 92 a5 92 7d 92 75 |..999...}.u| 0000000b
[toc] | [prev] | [next] | [standalone]
| From | "luser.droog" <luser.droog@gmail.com> |
|---|---|
| Date | 2012-12-08 19:18 -0600 |
| Message-ID | <ka0ou1$lma$1@dont-email.me> |
| In reply to | #1156 |
zupftom@googlemail.com wrote: > Am Samstag, 8. Dezember 2012 21:02:51 UTC+1 schrieb luser- -droog: >> I've been toying around with binary encodings and here are some results. >> >> >> >> The (mini-)goal is to shrink this sequence to read an input line from the >> >> source file: >> >> >> >> currentfile 999 string readline pop >> >> 35 chars >> >> >> >> A Binary Object Sequence starts with a four-byte header >> >> type length byte-length >> >> 129 5 ?? ?? >> >> >> >> Then an executable name >> >> type unused -1=systemname 32bit value >> >> 83 0 -1(16bits) 31 currentfile >> >> >> >> An integer is >> >> type unused lowbyte hibyte >> >> 01 0 999(16bits) >> >> >> >> So 4 + 6 (for the number) + 8 * 4 (names) = 42. Forget BOS! >> >> >> >> >> >> Binary Tokens are a little more promising, but limits to the first 255 >> >> system names. >> >> >> >> type val >> >> 146=x-sys-name 31=currentfile >> >> 135=LE-16b-int 999_10 = E7 03 >> >> 146 165=string >> >> 146 125=readline >> >> 146 117=pop >> >> >> >> As a hex-string, >> >> <921F87E70392A5927D9275>cvx exec >> >> 32 chars. >> >> >> >> Not much. :( > > You can shrink this to 11 bytes using binary token sequence in a real > binary file. Hexdump: > > $ hexdump -C test.ps > 00000000 92 1f 39 39 39 92 a5 92 7d 92 75 |..999...}.u| > 0000000b Oh, yeah! I forgot about that. Totally. That redeems the whole approach!
[toc] | [prev] | [next] | [standalone]
| From | tlvp <mPiOsUcB.EtLlLvEp@att.net> |
|---|---|
| Date | 2012-12-09 00:54 -0500 |
| Message-ID | <19xo54v4ids3k$.17udpg4wvtwtw$.dlg@40tude.net> |
| In reply to | #1157 |
On Sat, 08 Dec 2012 19:18:56 -0600, luser.droog wrote: > Oh, yeah! I forgot about that. Totally. That redeems the whole approach! If you're willing to sacrifice human readability :-) . Cheers, -- tlvp -- Avant de repondre, jeter la poubelle, SVP.
[toc] | [prev] | [next] | [standalone]
| From | luser- -droog <mijoryx@yahoo.com> |
|---|---|
| Date | 2012-12-16 15:58 -0800 |
| Subject | 47-char binary-name-string exec/Implicitly-named procedures (Re: golfing again) |
| Message-ID | <44758b15-4043-41fa-b4d3-a0f31c402e60@googlegroups.com> |
| In reply to | #1155 |
/${{<~O~>dup 1 4 3 roll put cvx exec}forall}def
This factors out the 146 tag (\222 0x92) so you can execute
a string containing just the 1-byte encoded system names.
<....>$
I'm also playing with a sort of dictionary construct with implicit names.
This is inspired by the DeBruijn numbers used in Binary Lambda Calculus
to refer to bindings by implicit labels. This could also be (ab)used to
add that missing pal GOTO to PS. :) :( :)
[65{( )dup 0 3 index put cvn exch % [ /A 65
currentfile 999 readline not{exit}if % [ /A 65 (line)
cvx exch % [ /A x(line) 65
1 add % [ /A x(line0) 66
}loop pop>>begin
This line is proc /A
This line is proc /B
3
/C yields the number 3
But there's so much overhead putting things into strings. Ugh!
Haven't found a real use for either of these, but it's something
to think about. :)
[toc] | [prev] | [next] | [standalone]
| From | luser- -droog <mijoryx@yahoo.com> |
|---|---|
| Date | 2012-12-16 16:02 -0800 |
| Subject | Re: 47-char binary-name-string exec/Implicitly-named procedures (Re: golfing again) |
| Message-ID | <fe628c62-7f8c-4564-8cd8-62c2ff13e6f0@googlegroups.com> |
| In reply to | #1177 |
On Sunday, December 16, 2012 5:58:24 PM UTC-6, luser- -droog wrote:
> /${{<~O~>dup 1 4 3 roll put cvx exec}forall}def
Whoops! That won't work. <~O~> only makes a 1-byte string.
So it's 48 using either <~O!~> or <9200>.
> This factors out the 146 tag (\222 0x92) so you can execute
>
> a string containing just the 1-byte encoded system names.
>
>
>
> <....>$
>
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.postscript
csiph-web