Skip to content

Commit

Permalink
fix a bug with reduce content not using fill
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Dec 23, 2024
1 parent 21e671c commit f20a18f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/algorithm/reduce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,15 +443,19 @@ pub fn reduce_content(ops: Ops, env: &mut Uiua) -> UiuaResult {
let [f] = get_ops(ops, env)?;
let xs = env.pop(1)?;
if let (1, Some(Primitive::Join)) = (xs.rank(), f.node.as_primitive()) {
if xs.row_count() == 0 {
env.push(match xs {
Value::Box(_) => Value::default(),
value => value,
});
return Ok(());
}
let mut rows = xs.into_rows().map(Value::unboxed);
let mut acc = rows.next().unwrap();
let (mut acc, rows) = if let Some(val) = env.value_fill() {
(val.clone(), xs.into_rows().map(Value::unboxed))
} else {
if xs.row_count() == 0 {
env.push(match xs {
Value::Box(_) => Value::default(),
value => value,
});
return Ok(());
}
let mut rows = xs.into_rows().map(Value::unboxed);
(rows.next().unwrap(), rows)
};
if acc.rank() == 0 {
acc.shape_mut().insert(0, 1);
}
Expand Down
2 changes: 2 additions & 0 deletions todo.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Uiua Todo

# 0.15
- Fix `filled take` bug
- Fix `uiua` ambiguity without `-w`
- Multidimensional `group`
- `un`/`anti` `stencil`
- Make `un by` more robust
Expand Down

0 comments on commit f20a18f

Please sign in to comment.