Creating a variadic reporter programmatically

This has me stumped :frowning:

How can I recreate a variadic reporter
I'd like to be able to create a list block of any length but I can't find a way of creating the 1st item by scripting

OpenSCAD_4_0_3_dev script pic

I see what you mean. I (and you, I suppose) would have expected LIST to be a regular variadic reporter, but it's not: LIST doesn't accept an input list. A perfectly good reason for that may be that a hypothetical untitled script pic - 2023-05-15T120349.618 would report a copy of it's input - several other mechanisms existing, so what would be the use of that?
So LIST must be a special form.

What do you need it for?

I absolutely understand why it's so hard to figure out, it's not shown when you split by blocks.


Basically, just put the number of inputs you want in the first input in the list, then put the values in the rest of the list. I split it up by using append, so it's easier to tell that it's different.

Or e.g.: untitled script pic - 2023-05-15T165740.565.
I remember having read about it earlier - within this forum, probably - but only now your post reminded me of it. The whole construct is so idiosyncratic, it ought to be described explicitly in the Reference Manual (I don't think it is).

Having gone out for the to the Lake District (lovely place in North_West England) with daughter and dog has inspired me to come up with this
OpenSCAD_4_0_3_dev script pic (1)

I wouldn’t recommend using join with input list, it can provide some buggy results if you use ringed inputs


This is because it treats the ring as a piece of text and not a function
Sometimes this happens, other times it doesn’t and I have no idea why

Does not fit your problem?
untitled script pic (10)

I'm confused as to how you got that result

But @ego-lay_atman-bay method is much simpler to invoke :slight_smile:

OpenSCAD_4_0_3_dev script pic (2)

And then use it to get original block

I was having a bath and it came to me that I've been so engrossed in splitting scripts and replacing blocks and re-joining in my OpenSCAD codification project - that I'd forgotten the basics of Snap! :slight_smile:

I was in doubt when Jens said that metaprogramming may be misleading in some way. But it seems that it really happens... :wink:

wow! I had no idea this was a thing!
Thanks so much!

Hi Dardoro,
Sorry to post here.
Do you still have the email heu***@gmail.com ?
TG

So using @ego-lay_atman-bay construct I can now programmatically re-create this type of reporter :slight_smile:

image

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.