diff options
| author | Omar Rizwan <omar@omar.website> | 2023-01-26 23:23:05 +0000 |
|---|---|---|
| committer | Omar Rizwan <omar@omar.website> | 2023-01-26 23:23:51 +0000 |
| commit | cfe27a6d0ce3cd82750b17a5a942e5691a082209 (patch) | |
| tree | e4ce4e2dd14ebf741aaf818ab4715bb6fcc43e4c /virtual-programs | |
| parent | make journal (diff) | |
| download | folk-cfe27a6d0ce3cd82750b17a5a942e5691a082209.tar.gz folk-cfe27a6d0ce3cd82750b17a5a942e5691a082209.zip | |
Fix with-all with new global ::matchId
Fixes
https://discord.com/channels/956758212152025098/1055633077323436103/1067636369263956028,
I think
Rename `On convergence` to `Before convergence`. Support fake lexical
scope in `Before convergence`.
Diffstat (limited to 'virtual-programs')
| -rw-r--r-- | virtual-programs/with-all.folk | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/virtual-programs/with-all.folk b/virtual-programs/with-all.folk index e7bbec8f..5f5c3d65 100644 --- a/virtual-programs/with-all.folk +++ b/virtual-programs/with-all.folk @@ -10,21 +10,19 @@ When /someone/ wishes to collect matches for /clause/ { foreach varName $varNames { dict set match $varName [set $varName] } dict set ::collectedMatches $clause $match true - - On unmatch [subst { - dict unset ::collectedMatches {$clause} {$match} - }] + On unmatch { dict unset ::collectedMatches $clause $match } } When $::nodename has step count /c/ { - On convergence [format { - set clause {%s} - set __matchId %d - if {[dict exists $Statements::matches $__matchId] && + set matchId $::matchId + Before convergence { + if {[dict exists $Statements::matches $matchId] && [dict exists $::collectedMatches $clause]} { + set oldMatchId $::matchId; set ::matchId $matchId set matches [dict get $::collectedMatches $clause] Say the collected matches for $clause are [dict keys $matches] + set ::matchId $oldMatchId } - } $clause $::matchId] + } } On unmatch { dict unset ::collectedMatches $clause } } |
