mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-02-23 10:29:51 +00:00
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
This commit is contained in:
@@ -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 [<myvar>]" "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<digitsRE>]' "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<currentTiddler>]">>
|
||||
@@ -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
|
||||
=[<myfun1>] =[<myfun2>] =>myvar
|
||||
```
|
||||
|
||||
The `:let` filter run prefix always clears the current result list.
|
||||
The `:let` filter run prefix always clears the current result list.
|
||||
|
||||
[[Let Filter Run Prefix (Examples)]]
|
||||
Reference in New Issue
Block a user