From 5234338e25802469b16f874f4a6adef3249be6ed Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Sat, 27 Sep 2025 14:47:24 +0100 Subject: [PATCH] small change similar to previous commit: in search-list.sml's 'backtrackFull' function, always check if the position is at the correct string before checking if we are at the place where the search should continue --- fcore/search-list.sml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fcore/search-list.sml b/fcore/search-list.sml index a9e8bfe..be5a443 100644 --- a/fcore/search-list.sml +++ b/fcore/search-list.sml @@ -5,11 +5,7 @@ struct val empty = Vector.fromList [] fun backtrackFull (pos, hd, absIdx, tl, acc, searchPos, searchString, prevTl) = - if searchPos <= 1 then - (* we are trying to backtrack to index 1, - * and then continue are search from here *) - loopSearch (pos, hd, absIdx, tl, acc, 0, searchString, prevTl) - else if pos < 0 then + if pos < 0 then case prevTl of prevHd :: prevTl => let @@ -29,6 +25,10 @@ struct | [] => (* Should never be called *) raise Fail "SearchList.backtrackFull error: line 24\n" + else if searchPos <= 1 then + (* we are trying to backtrack to index 1, + * and then continue are search from here *) + loopSearch (pos, hd, absIdx, tl, acc, 0, searchString, prevTl) else backtrackFull (pos - 1, hd, absIdx - 1, tl, acc, searchPos - 1, searchString, prevTl)