master
bel 2024-01-02 21:12:33 -07:00
parent 26595396cf
commit 709dd1dba3
1 changed files with 6 additions and 2 deletions

View File

@ -132,11 +132,15 @@ impl Words {
}
fn last_n_comparable_to_string(&self, n: usize) -> (String, usize) {
TODO
let v = self.to_comparable_words();
v = v[(v.len() - n).clamp(0, v.len())..].to_vec();
v.iter().map(|x| x.s).collect().join(" "), v[v.len()-1].idx
}
fn first_n_comparable_to_string(&self, n: usize) -> (String, usize){
TODO
let v = self.to_comparable_words();
v = v[0..n.clamp(0, v.len())].to_vec();
v.iter().map(|x| x.s).collect().join(" "), v[0].idx
}
fn comparable_len(&self) -> usize {