POV-Ray : Newsgroups : povray.bugreports : alpha.10064268 macro problem : Re: alpha.10064268 macro problem Server Time
26 Apr 2024 17:14:14 EDT (-0400)
  Re: alpha.10064268 macro problem  
From: jr
Date: 6 Apr 2021 06:05:00
Message: <web.606c31f554e5aaba79819d986cde94f1@news.povray.org>
hi,

"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> "jr" <cre### [at] gmailcom> wrote:
> >...
> > while on the subject, and given you seem interested :-), I'm pondering how to
> > reduce duplication of essentially identical/near identical code; am thinking
> > that an "odometer" type macro to compute the set of indices would allow me to
> > write much more "compact" walker macros.  any suggestions?  cheers.
>
> Bill's recent suggestion to you made me think of ways to iterate over the
> indices of an array.
>
> As my favorite programming language is Python, I tried out my ideas there.

chalk and cheese.  when, years ago, I heard that Python requires one to use
specific whitespace in order for the code to be "correct", I lost interest.

> So if you are familiar with Python, have a look at attached PDF-file.
> The code in the 2 last cells shouldn't be hard to convert to POV-Ray's SDL.

I had a v quick look just now, there are unfamiliar operators (like '//') so I'm
not sure, but it looks like I hit on the right idea when reducing 'Foreach()' to
calling the payload "product of dims" times[*].  (must have lucked out :-))
I'll try and find some time in next days to see whether I can replicate yr PDF
code in Tcl.


regards, jr.

[*] 20-odd lines in SDL isn't too shabby.


Post a reply to this message

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