Skip to content

Commit

Permalink
rename with to but
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Jun 12, 2024
1 parent 15f27e1 commit 235d769
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This version is not yet released. If you are reading this on the website, then t
- Add the experimental [`fft`](https://uiua.org/docs/fft) function, which performs the Fast Fourier transform
- The inverse FFT is also supported via [`un °`](https://uiua.org/docs/un)
- Add the experimental [`astar`](https://uiua.org/docs/astar) modifier, which performs the A* pathfinding algorithm
- Add the experimental [`with`](https://uiua.org/docs/with) modifier, which is a complement to [`on ⟜`](https://uiua.org/docs/on) and [`by ⊸`](https://uiua.org/docs/by)
- Add the experimental [`but`](https://uiua.org/docs/but) modifier, which is a complement to [`on ⟜`](https://uiua.org/docs/on) and [`by ⊸`](https://uiua.org/docs/by)
- Adjacent [`trace ⸮`](https://uiua.org/docs/trace)s now function as a single [`trace ⸮`](https://uiua.org/docs/trace) of more values
- N+1 adjacent [`stack ?`](https://uiua.org/docs/stack)s now format to N [`trace ⸮`](https://uiua.org/docs/trace)s
- Add the [`&camcap`](https://uiua.org/docs/&camcap) system function, which captures a frame from a camera
Expand Down
16 changes: 8 additions & 8 deletions site/primitives.json
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,14 @@
"class": "Planet",
"description": "Call two functions on two distinct sets of values"
},
"but": {
"glyph": "",
"outputs": 1,
"modifier_args": 1,
"class": "Stack",
"description": "Call a function but keep its last argument on the top of the stack",
"experimental": true
},
"by": {
"glyph": "",
"outputs": 1,
Expand Down Expand Up @@ -1248,14 +1256,6 @@
"class": "DyadicArray",
"description": "The n-wise windows of an array"
},
"with": {
"glyph": "",
"outputs": 1,
"modifier_args": 1,
"class": "Stack",
"description": "Call a function but keep its last argument on the top of the stack",
"experimental": true
},
"xlsx": {
"args": 1,
"outputs": 1,
Expand Down
6 changes: 3 additions & 3 deletions src/compile/modifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ impl Compiler {
}};
}
match prim {
Dip | Gap | On | By | With => {
Dip | Gap | On | By | But => {
// Compile operands
let (mut instrs, sig) = self.compile_operand_word(modified.operands[0].clone())?;
// Dip (|1 …) . diagnostic
Expand Down Expand Up @@ -488,7 +488,7 @@ impl Compiler {
instrs.insert(0, Instr::Prim(Pop, span));
Signature::new(sig.args + 1, sig.outputs)
}
prim if prim == On || prim == With && sig.args <= 1 => {
prim if prim == On || prim == But && sig.args <= 1 => {
instrs.insert(
0,
if sig.args == 0 {
Expand Down Expand Up @@ -543,7 +543,7 @@ impl Compiler {
}
Signature::new(sig.args.max(1), sig.outputs + 1)
}
With => {
But => {
let mut i = 0;
if sig.args > 1 {
instrs.insert(
Expand Down
4 changes: 2 additions & 2 deletions src/primitive/defs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1685,11 +1685,11 @@ primitive!(
/// : [⫯+ 2 5]
/// : [⫯- 2 5]
///
/// [with] can be used to copy a value from deep in the stack, or to move it.
/// [but] can be used to copy a value from deep in the stack, or to move it.
/// ex: # Experimental!
/// : [⫯⊙⊙⊙∘ 1 2 3 4]
/// : [⫯⊙⊙⊙◌ 1 2 3 4]
([1], With, Stack, ("with", '⫯')),
([1], But, Stack, ("but", '⫯')),
/// Call a function on two sets of values
///
/// For monadic functions, [both] calls its function on each of the top 2 values on the stack.
Expand Down
4 changes: 2 additions & 2 deletions src/primitive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ impl Primitive {
use SysOp::*;
matches!(
self,
With | (Coordinate | Astar | Fft | Triangle | Case)
But | (Coordinate | Astar | Fft | Triangle | Case)
| Sys(Ffi | MemCopy | MemFree | TlsListen)
| (Stringify | Quote | Sig)
)
Expand Down Expand Up @@ -834,7 +834,7 @@ impl Primitive {
| Primitive::Dip
| Primitive::On
| Primitive::By
| Primitive::With
| Primitive::But
| Primitive::Gap
| Primitive::Un
| Primitive::Under
Expand Down

0 comments on commit 235d769

Please sign in to comment.