Skip to content

Commit 7b4b8c5

Browse files
committed
make parse invertible
1 parent 113ad19 commit 7b4b8c5

File tree

4 files changed

+5
-0
lines changed

4 files changed

+5
-0
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ If you are reading this on the website, then these changes are live here.
1010
- [`range` ``](https://uiua.org/docs/range) called on a list of 0 or 1 values is now more consistent
1111
- [`fill` ``](https://uiua.org/docs/fill) now works with [`rotate` ``](https://uiua.org/docs/rotate) to give non-wrapping behavior
1212
- [`fill` ``](https://uiua.org/docs/fill) now works with [`find` ``](https://uiua.org/docs/find) if the searched-for array is longer than the array being searched
13+
- [`parse`](https://uiua.org/docs/parse) now works with [`invert` ``](https://uiua.org/docs/invert) and [`under` ``](https://uiua.org/docs/under)
1314
- The output of [`find` ``](https://uiua.org/docs/find) is now the same shape as the array being searched
1415
### Interpreter
1516
- Fix a bunch of bugs

src/algorithm/invert.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ fn prim_inverse(prim: Primitive, span: usize) -> Option<Instr> {
5050
Unbox => Instr::Prim(Box, span),
5151
Where => Instr::ImplPrim(InvWhere, span),
5252
Utf => Instr::ImplPrim(InvUtf, span),
53+
Parse => Instr::ImplPrim(InvParse, span),
5354
_ => return None,
5455
})
5556
}
@@ -69,6 +70,7 @@ fn impl_prim_inverse(prim: ImplPrimitive, span: usize) -> Option<Instr> {
6970
InvAtan => Instr::Prim(Atan, span),
7071
InvComplex => Instr::Prim(Complex, span),
7172
InvCouple => Instr::Prim(Couple, span),
73+
InvParse => Instr::Prim(Parse, span),
7274
_ => return None,
7375
})
7476
}

src/primitive/defs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,6 +1779,7 @@ impl_primitive!(
17791779
(1, InvTrace),
17801780
(1(2), InvAtan),
17811781
(1(2), InvComplex),
1782+
(1, InvParse),
17821783
// Unders
17831784
(3, Unselect),
17841785
(3, Unpick),

src/primitive/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,7 @@ impl ImplPrimitive {
755755
ImplPrimitive::LastMinIndex => env.monadic_ref_env(Value::last_min_index)?,
756756
ImplPrimitive::LastMaxIndex => env.monadic_ref_env(Value::last_max_index)?,
757757
ImplPrimitive::FirstWhere => env.monadic_ref_env(Value::first_where)?,
758+
ImplPrimitive::InvParse => env.monadic_ref(ToString::to_string)?,
758759
}
759760
Ok(())
760761
}

0 commit comments

Comments
 (0)