Commit Graph

42 Commits

Author SHA1 Message Date
7dc94632d6 fix backtracking bug in 'Nfa.getMatchesInRange' (we were passing the wrong value instead of 'strIdx' in the recursive call to the loop function) 2025-09-29 13:13:14 +01:00
5234338e25 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 2025-09-27 14:47:24 +01:00
d9380bcb64 pass regression test by modifying 'SearchList.backtrackRange' function. The modification that worked was swapping two if-statements around: first we check if the string position is 0 (and loop to check the previous string if so); in the else case, we check if the searchPos <= 1 (which signals for us to exit backtracking). Swapping the order of the if-statements means that, when we exit the loop, we always exit with string that is at this position. 2025-09-27 12:40:28 +01:00
20a542df29 in BinSearch.equalOrMore and BinSearch.equalOrLess, return ~1 if no item is found, for the sake of less ambiguity in usage. Functions that call these have also been adapted. 2025-09-13 02:18:14 +01:00
9ba3e8464b add backtract functionality for range search as well 2025-09-06 23:05:11 +01:00
435c520955 add backtracking functionality to search; when we find a partial but incomplete match, we want to start looking for a match from ('idx + 1'), where 'idx' is the index we started this failed search at. 2025-09-06 22:53:07 +01:00
2b3f0405c6 reimplement search-range functionality to scan range from the string from left to right 2025-08-30 23:31:55 +01:00
de46376e4e reimplement search list functionality (when building whole search list, not from range) to start from index 0, to get rid of edge cases resulting from reading the string backwards 2025-08-30 23:05:11 +01:00
7497dc7e7a add code for clojure-style persistent vectors 2025-08-30 18:12:47 +01:00
0647589f13 handle edge case in searching: when we look for 'abba' in the text 'abbabba', it looks like we should have two matches, but to be consistent with other programs, we only have one match 2025-08-30 17:16:02 +01:00
73affaa83a instead of clearing the search list when we delete, build a small part of it by searching through a small part that is likely to be visible on the user's screen, which gets rid of flickering effect and makes it look like the search list is not rebuilt from scratch 2025-08-07 15:37:32 +01:00
27c5d11dd7 code functions to build search list from a range in the buffer (not searching for every single match, but searching for visible matches on user's window) 2025-08-07 15:28:29 +01:00
752bb4d00f don't return (buffer, searchList) tuple when building search list, but only return search list itself. (No point returning buffer as it is never modified or moved.) 2025-08-07 14:40:14 +01:00
268fd47d7e add functions to help find previous/next match in the search list 2025-08-07 13:12:04 +01:00
fab8cfcf20 change representation of search list to be a plain int vector and not a zipper (I am not using it for incremental purposes anyway so no point using a zipper) 2025-08-06 00:42:24 +01:00
e06a27d5ad delete some dead code 2025-08-06 00:30:50 +01:00
f0f28a1318 clean up some dead code 2025-08-06 00:16:50 +01:00
01369627bf begin reimplementing search list data structure 2025-08-05 13:24:55 +01:00
a4ac1b9ae0 add function for testing search-list.sml 2025-08-04 12:08:35 +01:00
f4c9039af1 fix failing unit test in search-list.sml/build-search-list.sml: perform bounds checking into array 2025-08-04 08:33:48 +01:00
d399016c1a add 'SearchList.exists' function to fcore/search-list.sml function, and make sure we check if mmatchedIdx exists before inserting or appending (so we maintain set-like semantics where each number exists only once) 2024-11-24 21:38:58 +00:00
c6343cac40 in fcore/search-list.sml, only call 'insMiddle' function if new value is not in middle 2024-11-24 20:42:17 +00:00
ef395feea8 add similar fix described in previous commit to 'moveLeftAndDelete' function 2024-11-18 11:42:23 +00:00
25046dcb88 bug fix to search-list.sml's 'moveRightAndDelete' function by possibly deleting if start > finish, rather than terminating 2024-11-18 11:29:54 +00:00
e90df37b43 in search-list.sml: fix 'delRightFromHere' and 'delLeftFromHere' functions which joined newHd with left/right, rather than the tl, and therefore added new numbers to the list, which is incorrect behaviour. Fixed this by using joining with 'tl' rather than left/right. In build-search-list.sml: make fromRange function return tuple instead of an instance of app. Finally, in app-update.sml: progress towards refactoring 'helpRemoveChr' function to map and delete from searchList as desired. 2024-11-17 09:25:01 +00:00
f7cc2d4740 change 'targetLength' of SearchList.t from 1024 to 32 2024-11-16 19:59:46 +00:00
5e9f118b15 fixed two issues related to insertion in search-list.sml. First issue: in top level 'insert' function, we called 'insLeft' if new value is greater than first value on right, and we called 'insRight' in the opposite case; this is backwards. Second issue: in base cases of 'insLeft' and 'insRight', when we have reached the end of one side of the list, we used to return the same list we got back instead of adding the new value to this end of the list; this is now fixed. 2024-11-16 19:51:29 +00:00
f2b4f256ec bugfix: in search-list.sml's 'delRightFromHere' function, make sure we preserve the last part of the vector when finish < last 2024-11-16 09:05:47 +00:00
436b3e0d92 simplify and rewrite function 'del' in search-list.sml 2024-11-16 08:33:26 +00:00
0ba56bf6d3 amend lambdas in search-list.sml's 'moveRightAndMap' function, where wrong variable was used in lambda, and rename 'num' variable in that function to 'from' to make purpose and intent clearer 2024-11-16 04:55:02 +00:00
cac0d02fab initial implementation of building search list 2024-11-15 05:37:53 +00:00
cae9f19787 add search list to app type 2024-11-14 08:12:27 +00:00
91663a6cae done implementing search list 2024-11-13 12:54:47 +00:00
11df1a6bcd done implementing delete function in SearchList 2024-11-13 03:49:12 +00:00
fb236aa7a1 add another helper function for deleting in SearchList. (Only one more helper function to go now.) 2024-11-13 03:15:20 +00:00
204d171893 implement a couple of more helper functions for deletion 2024-11-12 20:46:07 +00:00
b24dbd0ede implement a helper function for delete 2024-11-12 13:07:28 +00:00
9b45f43948 start implementing delete in search-list.sml (with top-down programming, calling functions that do not yet exist) 2024-11-12 09:14:39 +00:00
3b81d087f0 implement function to go specific number in search-list.sml 2024-11-12 07:57:36 +00:00
1bae34a067 done with insert into search list 2024-11-12 03:15:04 +00:00
8bf0b64ef3 implement insRight function in search-list.sml 2024-11-12 03:05:14 +00:00
287dc5548d progress implementing searchList data structure 2024-11-11 13:23:37 +00:00