Skip to content

Commit

Permalink
make un by monadic work for structs
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Oct 6, 2024
1 parent f69dc63 commit 0577d39
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/algorithm/invert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1284,9 +1284,16 @@ fn invert_dup_pattern<'a>(
if instrs_clean_signature(instrs).map_or(true, |sig| sig != (1, 1)) {
continue;
}
let Ok((_before, after)) = under_instrs(instrs, Signature::new(1, 1), comp) else {
let Ok((_before, mut after)) = under_instrs(instrs, Signature::new(1, 1), comp) else {
continue;
};
while let [Instr::PushFunc(f), Instr::Call(_)] = after.as_slice() {
after = EcoVec::from(f.instrs(&comp.asm));
}
let mut instrs = &input[..end];
while let [Instr::PushFunc(f), Instr::Call(_)] = instrs {
instrs = f.instrs(&comp.asm);
}
let save_count: usize = after
.iter()
.map(|instr| match instr {
Expand All @@ -1302,8 +1309,8 @@ fn invert_dup_pattern<'a>(
continue;
}
for mid in 1..end {
let a = &input[..mid];
let b = &input[mid..];
let a = &instrs[..mid];
let b = &instrs[mid..];
if instrs_clean_signature(a).map_or(true, |sig| sig != (0, 1))
|| instrs_clean_signature(b).map_or(true, |sig| sig != (2, 1))
{
Expand Down
1 change: 0 additions & 1 deletion todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
## 0.13
The next version of Uiua

- Optimize filled array creation
- Stabilize `anti` and `obverse`
- Let `under obverse` use `un` or `anti` inverses if necessary
- Add `anti` and `obverse` to the tutorial
Expand Down

0 comments on commit 0577d39

Please sign in to comment.