Yet more new tricks!
A few days ago I added Seventh Sanctum functions to append to or replace tables.
Today I added some other functions.
- addEntry appends a new entry to the table, with weight and optional mask. This entry is added as plain text and is not resolved when added. It will be resolved when the table is called later.
- addResolved appends a new entry to the table, with weight and optional mask. This entry is resolved before addition. The text is then static.
- Although special characters can be escaped with backslash. I’m pretty sure you can trick it into embedding other active text.
- Yes, yes you can.
To check the latter point, I had these two tests
!d
&d
|1 @addEntry{d1}{1}{can call &e?}@iter{D1 &d1\n}{5}\n\
@addResolved{d2}{1}{can call &e?}@iter{D2 &d2\n}{5}\n\
@addResolved{d3}{1}{can call \&e?}@iter{D3 &d3\n}{5}
&d1
&d2
&d3
&e
|1 inside e 1!
|1 inside e 2!
|1 inside e 3!
|1 inside e 4!
|1 inside e 5!
(Minor implementation wart: you can’t add to a table that isn’t already known. Hence I have empty d1
, d2
, d3
tables.)
Output is as expected!
D1 can call inside e 5!?
D1 can call inside e 3!?
D1 can call inside e 4!?
D1 can call inside e 1!?
D1 can call inside e 4!?
D2 can call inside e 3!?
D2 can call inside e 3!?
D2 can call inside e 3!?
D2 can call inside e 3!?
D2 can call inside e 3!?
D3 can call inside e 3!?
D3 can call inside e 4!?
D3 can call inside e 5!?
D3 can call inside e 1!?
D3 can call inside e 2!?
That is
- d1 some static text and a call to e2.
- d2 is entirely static text, including output of a call to e2.
- d3 behaves like d1.
It seems redundant to have both options, but I can imagine wanting the behavior. For instance, generate a name (which will then be static), and append a random element when called.
But what can we do with all this?
Well now, that’s my next post!