Date: 2025-11-13 Status: In progress
The lazy automaton uses offset-adjusted bit vectors where cv[0] always corresponds to current word position i, but the Universal automaton uses absolute indexing relative to the subword window.
For input at position i (1-indexed), the bit vector β(x_i, s_n(w, i)) is computed over:
s_n(w, i) = w_{i-n} w_{i-n+1} ... w_v where v = min(|w|, i+n+1)
With padding: w_{-n+1} = ... = w_0 = $
Input position i=1, character 'b':
Checking from position I+0#0 (offset=0, word_pos=0+1=0...wait
Actually, let me reconsider the indexing. Looking at line 35:
s_n(w, i) = w_{i-n} w_{i-n+1} ... w_v where v = min(|w|, i + n + 1)
For i=1, n=1:
Let me look at the actual relevant_subword implementation:
fn relevant_subword(word: &str, position: usize, max_distance: u8) -> String {
let n = max_distance as i32;
let p = word.len() as i32;
let i = position as i32; // 1-indexed!
// Start index: i - n (can be negative, hence need padding)
let start = i - n;
// End index: min(p, i + n + 1)
let end = p.min(i + n + 1);
So for i=1 (first input char), n=1, word="ab" (p=2):
For our case: start=0, so NO padding needed!
This is the answer! The bit vector for input[0]='b' is [0, 1]:
When position I+offset#errors processes input at position k (0-indexed):
Wait, this is confusing. Let me trace through the actual accepts() function to see how input positions map to bit vectors.
accepts() function iterates through inputThe issue might be that we're 1-indexed in theory but 0-indexed in implementation, causing off-by-one errors in bit vector lookups.
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |