Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #1435

Re: What is the best way to work with a dictionary

From Cecil Westerhof <Cecil@decebal.nl>
Newsgroups comp.lang.postscript
Subject Re: What is the best way to work with a dictionary
Organization Decebal Computing
References (1 earlier) <b4drrlFju4mU1@mid.individual.net> <87vc4edufk.fsf@Aspire.decebal.nl> <0a7afe99-aaf2-474f-b03d-b5ac41a76b77@googlegroups.com> <87fvvhe15z.fsf@Aspire.decebal.nl> <8ab668f6-20b3-48a0-99f6-9dd14cf4b35d@googlegroups.com>
Date 2013-07-14 20:04 +0200
Message-ID <8761wddnm0.fsf@Aspire.decebal.nl> (permalink)

Show all headers | View raw


Op zondag 14 jul 2013 17:04 CEST schreef luser:

> On Sunday, July 14, 2013 8:11:52 AM UTC-5, Cecil Westerhof wrote:
>> Op zondag 14 jul 2013 02:04 CEST schreef luser:
>>
>>
>>> On Saturday, July 13, 2013 4:25:03 PM UTC-5, Cecil Westerhof wrote:
>>>
>>>> By the way: I read somewhere that the value before dict does not
>>>> matter. Is that true, or not?
>>>
>>> Since the Level-2 standard, dictionaries will auto-expand, so you
>>> don't have to worry about /dictfull errors if the initial size is 
>>> too small.
>>
>>
>> That means that when I use local variables, I can not change global
>> variables?
>>
>
> I think I misinterpreted the question. I thought you were talking
> about the 'int' in `int dict`, the value you use to create a dict of
> a certain size.

No, that is what I meant.


> For a dictionary that is "local" to a procedure, you can bypass it
> to access dictionaries lower on the dictstack. 
>
> /n 5 def
>
> /x {
> << /n 2 >> begin
> ...
> currentdict end /n 3 def begin  % change "global" n
> ...
> emd
> } def
>
> /y {
> << /lo 3 >> begin
> /n 27 store   % redefine "global" n 
> end
> } def

This is what I meant in a way. But because I often fill the values
from the stack I would then need to do something like this I think:
    % lo  y  -
    / y {
        << /lo -1 >> begin
        /lo exch def
        .
        .
        .
    }

Or can this be done more efficient?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Back to comp.lang.postscript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

What is the best way to work with a dictionary Cecil Westerhof <Cecil@decebal.nl> - 2013-07-13 22:13 +0200
  Re: What is the best way to work with a dictionary Helge Blischke <h.blischke@acm.org> - 2013-07-13 22:32 +0200
    Re: What is the best way to work with a dictionary Cecil Westerhof <Cecil@decebal.nl> - 2013-07-13 23:25 +0200
      Re: What is the best way to work with a dictionary luser- -droog <mijoryx@yahoo.com> - 2013-07-13 17:04 -0700
        Re: What is the best way to work with a dictionary Cecil Westerhof <Cecil@decebal.nl> - 2013-07-14 15:11 +0200
          Re: What is the best way to work with a dictionary luser- -droog <mijoryx@yahoo.com> - 2013-07-14 08:04 -0700
            Re: What is the best way to work with a dictionary Cecil Westerhof <Cecil@decebal.nl> - 2013-07-14 20:04 +0200
              Re: What is the best way to work with a dictionary Olle <olavi.sakari@gmail.com> - 2013-07-15 06:13 -0700
                Re: What is the best way to work with a dictionary Olle <olavi.sakari@gmail.com> - 2013-07-15 06:27 -0700

csiph-web