POV-Ray : Newsgroups : povray.beta-test : tuple in dict Server Time
26 Dec 2024 14:01:22 EST (-0500)
  tuple in dict (Message 5 to 14 of 14)  
<<< Previous 4 Messages Goto Initial 10 Messages
From: ingo
Subject: Re: tuple in dict
Date: 27 Nov 2018 17:27:27
Message: <XnsA9A7EE9FFD443seed7@news.povray.org>
in news:web.5bfd56506924cc99783c249c0@news.povray.org jr wrote:

> if you write:
> [...]

Thanks. Thats what I started with, but read somewhere the [2] can be 
omitted for one dimensional arrays,

ingo


Post a reply to this message

From: jr
Subject: Re: tuple in dict
Date: 28 Nov 2018 04:15:01
Message: <web.5bfe5bdd6924cc99783c249c0@news.povray.org>
hi,

ingo <ing### [at] tagpovrayorg> wrote:
> in news:web.5bfd56506924cc99783c249c0@news.povray.org jr wrote:
>
> > if you write:
> > [...]
>
> Thanks. Thats what I started with, but read somewhere the [2] can be
> omitted for one dimensional arrays,

yes, a new feature.  I think though that such arrays cannot be initialised where
they're declared  (clipka?).

fwiw, I used such arrays in 'queues.inc', have a look (posted in
text.scene-files, on Nov 6th).


regards, jr.


Post a reply to this message

From: clipka
Subject: Re: tuple in dict
Date: 28 Nov 2018 08:05:21
Message: <5bfe9291$1@news.povray.org>
Am 25.11.2018 um 17:13 schrieb ingo:
> Probably completely misread the docs on the previous one.

Indeed. Tuples are not a thing in POV-Ray. There is only a tuple-ish 
syntax to assign multiple variables at the same time.


> The following parses forever:

That's pretty much the worst of all outcomes. Guess I'll have to look 
into this.


Post a reply to this message

From: clipka
Subject: Re: tuple in dict
Date: 28 Nov 2018 08:06:29
Message: <5bfe92d5@news.povray.org>
Am 27.11.2018 um 15:36 schrieb jr:

> if you write:
> 
> #declare bone = dictionary {
>    ["face"]  : array [2] {fig["head"], fig["nose"]},
>    ["neck"]  : array [2] {fig["head"], fig["atlas"]},
>    ["spine"] : array [2] {fig["atlas"], fig["tail"]}
> }
> 
> it'll work.

Thanks for that find. It'll help narrow down the issue more quickly.


Post a reply to this message

From: clipka
Subject: Re: tuple in dict
Date: 28 Nov 2018 08:18:40
Message: <5bfe95b0$1@news.povray.org>
Am 27.11.2018 um 23:27 schrieb ingo:
> in news:web.5bfd56506924cc99783c249c0@news.povray.org jr wrote:
> 
>> if you write:
>> [...]
> 
> Thanks. Thats what I started with, but read somewhere the [2] can be
> omitted for one dimensional arrays,

Note that this isn't just a matter of convenience - the resulting arrays 
will behave differently, with the "non-sized" array being able to grow 
dynamically. The downside of such dynamically-sized arrays is that they 
require more memory.

So whenever you know the size of the array in advance, omitting it is 
bad practice.


Post a reply to this message

From: clipka
Subject: Re: tuple in dict
Date: 28 Nov 2018 09:26:05
Message: <5bfea57d$1@news.povray.org>
Apparently the dynamically-sized array doesn't like to have an initializer.

So this also enters an infinite loop:

     #declare Foo = array { 42, 4711 };


Post a reply to this message

From: clipka
Subject: Re: tuple in dict
Date: 28 Nov 2018 11:56:53
Message: <5bfec8d5$1@news.povray.org>
Am 28.11.2018 um 15:26 schrieb clipka:
> Apparently the dynamically-sized array doesn't like to have an initializer.

Should be fixed now.


Post a reply to this message

From: Bald Eagle
Subject: Re: tuple in dict
Date: 28 Nov 2018 18:55:00
Message: <web.5bff2a636924cc99765e06870@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:


> fwiw, I used such arrays in 'queues.inc', have a look (posted in
> text.scene-files, on Nov 6th).

Hi jr,
I've only had a brief look through your sorting macros (many thanks).

You seem to be fluent with the dictionary syntax and usage.

I don't really have much of an understanding of these.

At some point, do you think it would be possible for you to write a pov file
with some illuminating comments and run the dictionaries through their paces?

Sort of a "here's the basics", followed by: "and if you want to get fancy, just
look what you can do...!"


It might save me 20 or 30 humbling posts.   ;)


Post a reply to this message

From: jr
Subject: Re: tuple in dict
Date: 28 Nov 2018 19:45:01
Message: <web.5bff36236924cc99c98b24460@news.povray.org>
hi,

"Bald Eagle" <cre### [at] netscapenet> wrote:
> "jr" <cre### [at] gmailcom> wrote:
> > fwiw, I used such arrays in 'queues.inc', have a look (posted in
> > text.scene-files, on Nov 6th).
> Hi jr,
> I've only had a brief look through your sorting macros (many thanks).
> You seem to be fluent with the dictionary syntax and usage.

too much credit.

> At some point, do you think it would be possible for you to write a pov file
> with some illuminating comments and run the dictionaries through their paces?
> Sort of a "here's the basics", followed by: "and if you want to get fancy, just
> look what you can do...!"
> It might save me 20 or 30 humbling posts.   ;)

I'm not very creative, how about a collaboration?  suggest one of your
scenes/WIPs where one or more queues might be "handy", or simply something where
the use of dictionaries is of use to you.  I'll be happy to work it through with
you.  what say you?  ;-)


regards, jr.


Post a reply to this message

From: ingo
Subject: Re: tuple in dict
Date: 29 Nov 2018 04:59:16
Message: <XnsA9A96FC78CE4Eseed7@news.povray.org>
in news:5bfec8d5$1@news.povray.org clipka wrote:

> Am 28.11.2018 um 15:26 schrieb clipka:
>> Apparently the dynamically-sized array doesn't like to have an
>> initializer. 
> 
> Should be fixed now.
> 

Nice. Thanks,

ingo


Post a reply to this message

<<< Previous 4 Messages Goto Initial 10 Messages

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.