Skip to content

Commit

Permalink
rename left inverses to on-inverses
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Jun 11, 2024
1 parent de691d3 commit 9fcc114
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/algorithm/invert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,13 @@ static INVERT_PATTERNS: &[&dyn InvertPattern] = {
&(Val, pat!(Min, (Over, Ge, 1, MatchPattern))),
&(Val, pat!(Max, (Over, Le, 1, MatchPattern))),
&pat!(Pick, (Dup, Shape, Range)),
&InvertPatternFn(invert_left_pattern, "left"),
&InvertPatternFn(invert_on_inv_pattern, "on inverse"),
&InvertPatternFn(invert_temp_pattern, "temp"),
&InvertPatternFn(invert_push_pattern, "push"),
]
};

static LEFT_INVERT_PATTERNS: &[&dyn InvertPattern] = {
static ON_INVERT_PATTERNS: &[&dyn InvertPattern] = {
use ImplPrimitive::*;
use Primitive::*;
&[
Expand Down Expand Up @@ -432,7 +432,7 @@ pub(crate) fn under_instrs(
&stash1!(Sign, (Abs, Mul)),
// Pop
&pat!(Pop, (PushToUnder(1)), (PopUnder(1))),
// Coupling left inverses
// Coupling on-inverses
&(
Val,
pat!(
Expand Down Expand Up @@ -743,12 +743,12 @@ fn invert_trivial_pattern<'a>(
None
}

fn invert_left_pattern<'a>(
fn invert_on_inv_pattern<'a>(
input: &'a [Instr],
comp: &mut Compiler,
) -> Option<(&'a [Instr], EcoVec<Instr>)> {
let (input, mut instrs) = Val.invert_extract(input, comp)?;
for pattern in LEFT_INVERT_PATTERNS {
for pattern in ON_INVERT_PATTERNS {
if let Some((input, inv)) = pattern.invert_extract(input, comp) {
instrs.extend(inv);
return Some((input, instrs));
Expand Down Expand Up @@ -1368,7 +1368,7 @@ fn invert_temp_pattern<'a>(
if before_sig.args == 0 && before_sig.outputs != 0 {
continue;
}
for pat in LEFT_INVERT_PATTERNS {
for pat in ON_INVERT_PATTERNS {
if let Some((after, pseudo_inv)) = pat.invert_extract(after, comp) {
if let Some(after_inv) = invert_instrs(after, comp) {
let mut instrs = eco_vec![start_instr.clone()];
Expand Down
4 changes: 3 additions & 1 deletion todo.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Uiua Todo

- 0.12
- Improve pad git import error messages
- by inverses
- `setinv` on and by inverses
- Document on and by inverses
- Pervasive switch functions and `repeat`
- Stack-source locality tutorial
- Axis swizzles?
Expand Down

0 comments on commit 9fcc114

Please sign in to comment.