From add3d425b5fef42d801e477f27c03eef054fa885 Mon Sep 17 00:00:00 2001 From: btheado Date: Sun, 22 Feb 2026 15:10:10 -0500 Subject: [PATCH] Add let filter run examples (#9681) * Add :let filter run prefix examples Includes one example from @yaisog at #8972 * Added link to the new :let filter run examples * Fixed broken link --- .../syntax/Let Filter Run Prefix (Examples).tid | 13 +++++++++++++ .../filters/syntax/Let Filter Run Prefix.tid | 6 ++++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 editions/tw5.com/tiddlers/filters/syntax/Let Filter Run Prefix (Examples).tid diff --git a/editions/tw5.com/tiddlers/filters/syntax/Let Filter Run Prefix (Examples).tid b/editions/tw5.com/tiddlers/filters/syntax/Let Filter Run Prefix (Examples).tid new file mode 100644 index 000000000..e177c54be --- /dev/null +++ b/editions/tw5.com/tiddlers/filters/syntax/Let Filter Run Prefix (Examples).tid @@ -0,0 +1,13 @@ +created: 20260222152853141 +modified: 20260222184916224 +tags: [[Let Filter Run Prefix]] +title: Let Filter Run Prefix (Examples) +type: text/vnd.tiddlywiki + +<<.operator-example 1 "3 2 1 4 :let[[myvar]] 6 7 8 [(myvar)sort[]]" "Uses the named prefix">> +<<.operator-example 2 "3 2 1 4 =>myvar 6 7 8 [(myvar)sort[]]" "Uses the short-hand prefix">> +<<.operator-example 3 "3 2 1 4 =>myvar 6 7 8 []" "Angle brackets return only the first value">> +<<.operator-example 4 "3 2 1 4 =>mynumbers [(mynumbers)sum[]] [(mynumbers)average[]]">> +<<.operator-example 5 '"[0-9]" =>digitsRE abc 123 de45 67fg hij :filter[regexp]' "A regular expression containing square brace requires using a variable parameter">> +<<.operator-example 6 '"[prefix[ca]then[ca]]" "[suffix[at]then[at]]" other =>myfilters cat can bat bug :cascade[(myfilters)]' "Define filters to be used with the [[Cascade Filter Run Prefix]]">> +<<.operator-example 7 "[[⁎ ]] [[⁑ ]] [[⁂ ]] :let[[prefixList]] [tag[Learning]first[3]] :map:flat[(prefixList)addsuffix]">> \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/filters/syntax/Let Filter Run Prefix.tid b/editions/tw5.com/tiddlers/filters/syntax/Let Filter Run Prefix.tid index 464011add..262347ccf 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Let Filter Run Prefix.tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Let Filter Run Prefix.tid @@ -15,7 +15,7 @@ type: text/vnd.tiddlywiki [[run|"Filter Run"]] """/> -The `:let` filter run prefix assigns the title list resulting from previous filter runs to a [[multi-valued variable|Multi-Valued Variable]]. The variable is named with the first result returned by the filter run. +The `:let` filter run prefix assigns the title list resulting from previous filter runs to a [[multi-valued variable|Multi-Valued Variables]]. The variable is named with the first result returned by the filter run. The variable is made available to the remaining [[filter runs|Filter Run]] in the [[filter expression|Filter Expression]]. Only the first item in the result list is returned when the variable is accessed in the usual way (or an empty string if the result list is empty). Using round brackets instead of angle brackets around a variable name as an operand retrieves the complete list of items in the result list. @@ -25,4 +25,6 @@ This prefix has an optional [[shortcut syntax|Shortcut Filter Run Prefix]] symbo =[] =[] =>myvar ``` -The `:let` filter run prefix always clears the current result list. \ No newline at end of file +The `:let` filter run prefix always clears the current result list. + +[[Let Filter Run Prefix (Examples)]] \ No newline at end of file