examples: refactor retro-locate

FossilOrigin-Name: 1f82401f2f13a624482fb585ae0e87b1645950504fb1c1c7126aa1bebc287e8b
This commit is contained in:
crc 2021-01-27 14:49:39 +00:00
parent c292714f01
commit 45a1619f9e

View file

@ -2,5 +2,10 @@
~~~
'Line var
'tags [ &Heap [ ASCII:HT s:tokenize !Line @Line #0 a:fetch #0 script:get-argument s:eq? [ @Line #2 a:fetch @Line #1 a:fetch s:put $: c:put s:put nl ] if ] v:preserve ] file:for-each-line
:parse (s-a) ASCII:HT s:tokenize dup !Line ;
:word (-s) #0 script:get-argument ;
:match? (a-f) #0 a:fetch word s:eq? ;
:fields (-ss) @Line [ #2 a:fetch ] [ #1 a:fetch ] bi ;
:display (-) fields s:put $: c:put s:put nl ;
'tags [ &Heap [ parse match? [ display ] if ] v:preserve ] file:for-each-line
~~~