POV-Ray : Newsgroups : povray.general : return dictionary from macro [bug?] : Re: return dictionary from macro [bug?] Server Time
19 Apr 2024 05:04:44 EDT (-0400)
  Re: return dictionary from macro [bug?]  
From: jr
Date: 17 Apr 2021 09:00:00
Message: <web.607ada6ed2107a6c79819d986cde94f1@news.povray.org>
hi,

William F Pokorny <ano### [at] anonymousorg> wrote:
> ... However, I need to test(1) with large dictionaries having
> key hashing collisions to be sure my fixes - as well the previously
> existing code - work correctly.
> ...
> (1) I suspect jr's recent foreach include work will come in handy! :-)

still ongoing but thank you for the vote of confidence.  and glad the code will
get a work-out.  :-)

quickly cobbled up example of what I think you have in mind, ie automating the
dictionary creation, below.  hth.


regards, jr.


#version 3.8;

global_settings {assumed_gamma 1}

#include "foreach.inc"

#declare A = array {
  "Aa", "Ab", "Ac", "Ad", "Ae", "Af", "Ag", "Ah", "Ai", "Aj", "Ak", "Al", "Am",
  "An", "Ao", "Ap", "Aq", "Ar", "As", "At", "AA", "Av", "Aw", "Ax", "Ay", "Az"
};

#macro mkKeys(i_,j_,elem_,arg_)
  #local arg_[elem_] = i_ * j_;
#end

#declare D = dictionary {
  .Macro: "mkKeys",
  .Walk: 1,
  .Extra: on,
  .Arg: "R"
};

#declare R = dictionary {
  .foo: 0
};

Foreach(A,D)

#debug concat("Az = ",str(R.Az,0,0),".\n")


Post a reply to this message

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