Skip to content

Commit

Permalink
add under length
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Sep 20, 2024
1 parent 46c2a90 commit 0f720bb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ This version is not yet released. If you are reading this on the website, then t
- [`under ⍜`](https://uiua.org/docs/under) [`un °`](https://uiua.org/docs/un) [`bits ⋯`](https://uiua.org/docs/bits) now preserves a minimum bit length
- [`under ⍜`](https://uiua.org/docs/under) [`reverse ⇌`](https://uiua.org/docs/reverse) and [`under ⍜`](https://uiua.org/docs/under) [`transpose ⍉`](https://uiua.org/docs/transpose) are now smarter with respect to the ranks of [`under ⍜`](https://uiua.org/docs/under)'s second function
- For example `⍜⇌°⊂` behaves in a more useful way
- [`under ⍜`](https://uiua.org/docs/under) [`len ⧻`](https://uiua.org/docs/len) now reshapes an array to have the transformed length
- `NaN` and `` indices for [`pick ⊡`](https://uiua.org/docs/pick) and [`select ⊏`](https://uiua.org/docs/select) now get the [`fill ⬚`](https://uiua.org/docs/fill) value
- [`scan \\`](https://uiua.org/docs/scan) now accepts functions that take more than 2 arguments
- The behavior is similar to the analogous behavior for [`reduce /`](https://uiua.org/docs/reduce)
Expand Down
2 changes: 2 additions & 0 deletions site/src/primitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ fn all_unders() -> impl IntoView {
{ inverse_row([Sign], No, "", "⍜±(×2) ¯5") }
{ inverse_row([First], No, "", "⍜⊢(×10) [1 2 3 4 5]") }
{ inverse_row([First, Reverse], No, "", "⍜(⊢⇌|×10) [1 2 3 4 5]") }
{ inverse_row([Shape], No, view!(<Prim prim=Reshape/>), "⍜△⇌ [1_2_3 4_5_6]") }
{ inverse_row([Len], No, view!(<Prim prim=Reshape/>), "⍜⧻(+1) [1_2_3 4_5_6]") }
{ inverse_row([Deshape], No, "", "⍜♭⇌ ↯3_3⇡9") }
{ inverse_row([Rise], No, "", "⍜⍏(↻¯1). [1 4 2 3 5]") }
{ inverse_row([Fall], No, "", "⍜⍖(↻¯1). [1 4 2 3 5]") }
Expand Down
5 changes: 5 additions & 0 deletions src/algorithm/invert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,11 @@ pub(crate) fn under_instrs(
&pat!(Fix, (Fix), (UndoFix)),
&pat!(UndoFix, (UndoFix), (Fix)),
&stash1!(Shape, (Flip, Reshape)),
&pat!(
Len,
(CopyToUnder(1), Shape, CopyToUnder(1), First),
(PopUnder(1), UndoFirst, PopUnder(1), Flip, Reshape)
),
&pat!(
Deshape,
(Dup, Shape, PushToUnder(1), Deshape),
Expand Down
2 changes: 0 additions & 2 deletions todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

- 0.13
- `base` tweak
- Rename and stabilize `but` and `with`
- Likely `with` and `off`
- Update language tour
- Update design page
- Sound easter egg
Expand Down

0 comments on commit 0f720bb

Please sign in to comment.