Skip to content

Commit a8d1d82

Browse files
authored
stabilize exponential (#721)
1 parent 629935f commit a8d1d82

File tree

8 files changed

+21
-26
lines changed

8 files changed

+21
-26
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ This version is not yet released. If you are reading this on the website, then t
2222
- Add experimental sided subscripts for [`backward ˜`](https://uiua.org/docs/backward)
2323
- Add numeric subscripts for [`occurrences ⧆`](https://uiua.org/docs/occurrences)
2424
- Deprecate experimental [`progressive indexof ⊘`](https://uiua.org/docs/progressiveindexof) in favor of [`occurrences ⧆`](https://uiua.org/docs/occurrences)
25+
- Deprecate [`logarithm ₙ`](https://uiua.org/docs/logarithm) in favor of [`exponential ₑ`](https://uiua.org/docs/exponential)
2526
- Add the [`exponential ₑ`](https://uiua.org/docs/exponential) function, which computes the exponential function
2627
- Remove experimental `ln` in favor of [`exponential ₑ`](https://uiua.org/docs/exponential)
2728
- Remove previously deprecated `signature` and `stringify` modifiers

parser/src/defs.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -217,16 +217,13 @@ primitive!(
217217
(1, Sqrt, MonadicPervasive, ("sqrt", '√')),
218218
/// Get the exponential of a number
219219
///
220-
/// ex: # Experimental!
221-
/// : ₑ 1
220+
/// ex: ₑ 1
222221
/// You can get the natural logarithm with [un].
223-
/// ex: # Experimental!
224-
/// : °ₑ e
222+
/// ex: °ₑ e
225223
/// You can give a subscript to set the base.
226-
/// ex: # Experimental!
227-
/// : ₑ₂ 8
224+
/// ex: ₑ₂ 8
228225
/// : ₑ₁₀ 6
229-
(1, Exp, MonadicPervasive, ("exponential", 'ₑ'), { experimental: true }),
226+
(1, Exp, MonadicPervasive, ("exponential", 'ₑ')),
230227
/// Get the sine of a number
231228
///
232229
/// ex: ∿ 1

parser/src/primitive.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ impl Primitive {
257257
pub fn deprecation_suggestion(&self) -> Option<String> {
258258
use Primitive::*;
259259
Some(match self {
260+
Log => format!("use subscripted {} or {Anti}{Backward}{Pow}", Exp.format()),
260261
Rerank => format!(
261262
"use subscripted {} or {Un}{By}({Len}{Shape}) instead",
262263
Deshape.format()

site/primitives.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,13 @@
640640
"class": "Environment",
641641
"description": "Get the executable extension for the current platform"
642642
},
643+
"exponential": {
644+
"glyph": "",
645+
"args": 1,
646+
"outputs": 1,
647+
"class": "MonadicPervasive",
648+
"description": "Get the exponential of a number"
649+
},
643650
"fall": {
644651
"glyph": "",
645652
"args": 1,
@@ -888,18 +895,13 @@
888895
"class": "DyadicPervasive",
889896
"description": "Compare for less than"
890897
},
891-
"ln": {
892-
"args": 1,
893-
"outputs": 1,
894-
"class": "MonadicPervasive",
895-
"description": "Get the natural logarithm of a number"
896-
},
897898
"logarithm": {
898899
"glyph": "",
899900
"args": 2,
900901
"outputs": 1,
901902
"class": "DyadicPervasive",
902-
"description": "Get the based logarithm of a number"
903+
"description": "Get the based logarithm of a number",
904+
"deprecated": true
903905
},
904906
"map": {
905907
"args": 2,

site/src/other.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ pub fn Subscripts() -> impl IntoView {
558558
subscript(Transpose, "Repeat", "# Experimental!\n△ ⍉₃ °△1_2_3_4_5"),
559559
subscript(Sqrt, "Nth root", "√₃ [8 27 125]"),
560560
subscript(Neg, "Turn one Nth in the complex plane", "⁅₃ ⍥₄⊸¯₄ 1"),
561-
subscript(Exp, "Base N exponential", "# Experimental!\n₂ 8"),
561+
subscript(Exp, "Base N exponential", "₂ 8"),
562562
subscript(Round, "To N decimal places", "⁅₃ π"),
563563
subscript(Floor, "To N decimal places", "# Experimental!\n⌊₄ π\n⌊₄ τ"),
564564
subscript(Ceil, "To N decimal places", "# Experimental!\n⌈₄ π\n⌈₄ τ"),

site/src/primitive.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ fn all_uns() -> impl IntoView {
221221
{ inverse_row([Mul], Required, "", "°(×2) 5") }
222222
{ inverse_row([Div], Required, "", "°(÷2) 5") }
223223
{ inverse_row([Pow], Required, "", "°(ⁿ2) 36") }
224-
{ inverse_row([Log], Required, "", (ₙ2) 8") }
224+
{ inverse_row([Exp], No, "Natural logarithm", ₑ 10") }
225225
{ inverse_row([Add, Dup], No, "", "°(+.) 10") }
226226
{ inverse_row([Mul, Dup], No, "", "°(×.) 16") }
227227
{ inverse_row([Atan], No, view!(<Prim prim=Sin/>" and cosine"), "°∠ π") }
@@ -311,7 +311,7 @@ fn all_unders() -> impl IntoView {
311311
{ inverse_row([Div], Optional, view!("Optional "<Prim prim=Backward/>), "⍜÷(+1) 2 5") }
312312
{ inverse_row([Modulus], Optional, view!("Optional "<Prim prim=Backward/>), "⍜◿(×10) 4 9") }
313313
{ inverse_row([Pow], Optional, view!("Optional "<Prim prim=Backward/>), "⍜ⁿ(-9) 2 5") }
314-
{ inverse_row([Log], Optional, view!("Optional "<Prim prim=Backward/>), "⍜ₙ(+1) 3 8") }
314+
{ inverse_row([Exp], No, "", "⍜ₑ(ⁿ2) 7") }
315315
{ inverse_row([Get], Optional, "", "⍜get(×10) @b map \"abc\" 1_2_3") }
316316
{ inverse_row([Floor], No, "", "⍜⌊(×10) 1.5") }
317317
{ inverse_row([Ceil], No, "", "⍜⌈(×10) 1.5") }

tests/under.ua

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,23 +171,22 @@
171171
⍤⤙≍ 5 ⍜×∘ 3 5
172172
⍤⤙≍ 5 ⍜÷∘ 3 5
173173
⍤⤙≍ 5 ⍜×⁅1e12 ⍜ⁿ∘ 3 5
174-
⍤⤙≍ 5 ⍜×⁅1e12 ⍜ₙ∘ 3 5
175174
⍤⤙≍ 5 ⍜×⁅1e12 ⍜(ⁿ˜÷1)∘ 3 5
176175
# Flipped Outside
177176
⍤⤙≍ 5 ⍜˜+∘ 3 5
178177
⍤⤙≍ 5 ⍜˜-∘ 3 5
179178
⍤⤙≍ 5 ⍜˜×∘ 3 5
180179
⍤⤙≍ 5 ⍜˜÷∘ 3 5
181180
⍤⤙≍ 5 ⍜×⁅1e12 ⍜˜ⁿ∘ 3 5
182-
⍤⤙≍ 5 ⍜×⁅1e12 ⍜˜∘ 3 5
181+
⍤⤙≍ 5 ⍜×⁅1e12 ⍜˜÷∘ 3 5
183182
⍤⤙≍ 5 ⍜×⁅1e12 ⍜(ⁿ⊙(˜÷1))∘ 3 5
184183
# Normal Inside
185184
⍤⤙≍ 5 ⍜(+3)∘ 5
186185
⍤⤙≍ 5 ⍜(-3)∘ 5
187186
⍤⤙≍ 5 ⍜(×3)∘ 5
188187
⍤⤙≍ 5 ⍜(÷3)∘ 5
189188
⍤⤙≍ 5 ⍜×⁅1e12 ⍜(ⁿ3)∘ 5
190-
⍤⤙≍ 5 ⍜×⁅1e12 ⍜(ₙ3)∘ 5
189+
⍤⤙≍ 5 ⍜×⁅1e12 ⍜(÷3)∘ 5
191190
⍤⤙≍ 5 ⍜×⁅1e12 ⍜(ⁿ˜÷1 3)∘ 5
192191
# Flipped Inside
193192
⍤⤙≍ 5 ⍜(˜+3)∘ 5
@@ -200,8 +199,7 @@
200199
⍤⤙≍ 5 ⍜°(˜÷3)∘ 5
201200
⍤⤙≍ 5 ⍜×⁅1e12 ⍜(˜ⁿ3)∘ 5
202201
⍤⤙≍ 5 ⍜×⁅1e12 ⍜°(˜ⁿ3)∘ 5
203-
⍤⤙≍ 5 ⍜×⁅1e12 ⍜(˜ₙ3)∘ 5
204-
⍤⤙≍ 5 ⍜×⁅1e12 ⍜°(˜ₙ3)∘ 5
202+
⍤⤙≍ 5 ⍜×⁅1e12 ⍜(˜÷3)∘ 5
205203
⍤⤙≍ 5 ⍜×⁅1e12 ⍜(ⁿ˜÷1⊙3)∘ 5
206204
⍤⤙≍ 5 ⍜×⁅1e12 ⍜°(ⁿ˜÷1⊙3)∘ 5
207205
# Dipped Inside
@@ -215,8 +213,6 @@
215213
⍤⤙≍ 5 ⍜°(÷⊙3)∘ 5
216214
⍤⤙≍ 5 ⍜×⁅1e12 ⍜(ⁿ⊙3)∘ 5
217215
⍤⤙≍ 5 ⍜×⁅1e12 ⍜°(ⁿ⊙3)∘ 5
218-
⍤⤙≍ 5 ⍜×⁅1e12 ⍜(ₙ⊙3)∘ 5
219-
⍤⤙≍ 5 ⍜×⁅1e12 ⍜°(ₙ⊙3)∘ 5
220216
⍤⤙≍ 5 ⍜×⁅1e12 ⍜(ⁿ˜÷1⊙3)∘ 5
221217
⍤⤙≍ 5 ⍜×⁅1e12 ⍜°(ⁿ˜÷1⊙3)∘ 5
222218

tests/units.ua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,6 @@ Test!÷
316316
Test!˜÷
317317
Test!ⁿ
318318
Test!˜ⁿ
319-
Test!ₙ
320-
Test!˜ₙ
321319

322320
# Ana inverses
323321
⍤⤙≍ [1 0] °/ℂ i

0 commit comments

Comments
 (0)