This is likely a very quick syntax question for someone in the know.
I have a working solution to my immediate problem, but I’m wondering why an alternative I would have thought to work the same but more efficiently does not work.
This works just fine, splitting an input string into three component parts:
<!-- currentTiddler is, say, "north-10-3" -->
<$let
block={{{ [all[current]split[-]nth[1]] }}}
cols={{{ [all[current]split[-]nth[2]] }}}
rows={{{ [all[current]split[-]nth[3]] }}}
>
<<currentTiddler>> :: block: "<<block>>", rows: "<<rows>>", cols: "<<cols>>"
</$let>
<!--yielding: -->
north-10-3 :: block: "north", rows: "3", cols: "10"
This one does not:
<!-- currentTiddler is, say, "north-10-3" -->
<$let
parts={{{ [all[current]split[-]] }}}
block={{{ [<parts>nth[1]] }}}
cols={{{ [<parts>nth[2]] }}}
rows={{{ [<parts>nth[3]] }}}
>
<<currentTiddler>> :: block: "<<block>>", rows: "<<rows>>", cols: "<<cols>>"
</$let>
<!-- yielding -->
north-10-3 :: block: "north", rows: "", cols: ""
And I simply don’t understand why that is. I thought that perhaps adding enlist[]
at the end of the parts
filter would fix it, but if anything, it made it worse.
(I am right that if I get the filters correct, this is how <$let ...>
is supposed to work right? The definitions can be based on earlier ones in the widget, right?)
Can someone explain why its wrong, and if there’s a simple way to fix it. And if possible, could you confirm whether this should actually be more performant? This is happening inside a nested loop, so I’d like to at least not be stupid about performance.