From 45a1619f9efeb24d1a959defc5d9b64d7b83d543 Mon Sep 17 00:00:00 2001 From: crc Date: Wed, 27 Jan 2021 14:49:39 +0000 Subject: [PATCH] examples: refactor retro-locate FossilOrigin-Name: 1f82401f2f13a624482fb585ae0e87b1645950504fb1c1c7126aa1bebc287e8b --- example/retro-locate.retro | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/example/retro-locate.retro b/example/retro-locate.retro index 6160b03..dc1993b 100755 --- a/example/retro-locate.retro +++ b/example/retro-locate.retro @@ -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 ~~~