From 35f3a4d141203761932df162498bab9cab7a43d6 Mon Sep 17 00:00:00 2001 From: crc <> Date: Fri, 8 Mar 2024 18:33:35 +0000 Subject: [PATCH] takawiri: merge parts of the watchlist code update FossilOrigin-Name: 6de219bd0b907e458cbdffc6fdeb89dce8fe70ae81c6f4e0ad24b02ef4487d78 --- takawiri.retro | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/takawiri.retro b/takawiri.retro index bad6186..a60bb21 100755 --- a/takawiri.retro +++ b/takawiri.retro @@ -77,26 +77,30 @@ do something like: 'Compiler &Compiler watch ~~~ -{ 'Add_Zero - 'Heap____ - 'Compiler +{ '________ + '________ + '________ '________ '________ } 'WatchlistLabels d:create #5 , &, a:for-each -'Watchlist d:create #5 , - #0 , - &Heap , - &Compiler , - #5 allot +'Watchlist d:create #5 , &Heap , #-1 , #-1 , #-1 , #-1 , + +:watchlist:find (a-n) + dup &Watchlist a:contains? [ drop #-1 ] -if; + &Watchlist swap a:index ; + +:watch (sa-) s:keep drop-pair ; +:unwatch (a-) + watchlist:find dup n:positive? [ drop ] -if + &Watchlist #-1 'abc 'acab reorder a:store ; -:watch (sa-) drop-pair ; -:unwatch (a-) drop ; :watchlist (-) #19 #5 [ dup #84 vt:row,col dss:label &WatchlistLabels over #19 n:sub a:fetch s:put sp dss:value &Watchlist over #19 n:sub a:fetch - fetch n:put n:inc vt:reset ] times drop ; + dup n:positive? [ fetch ] [ drop #0 ] choose + n:put n:inc vt:reset ] times drop ; ~~~ # UI