@@ -570,6 +570,8 @@ fn dyadic_level(
570
570
mut yn : usize ,
571
571
env : & mut Uiua ,
572
572
) -> UiuaResult {
573
+ xn = xn. min ( xs. rank ( ) ) ;
574
+ yn = yn. min ( ys. rank ( ) ) ;
573
575
let xs_prefix = & xs. shape ( ) [ ..xn] ;
574
576
let ys_prefix = & ys. shape ( ) [ ..yn] ;
575
577
if !xs_prefix. iter ( ) . zip ( ys_prefix) . all ( |( a, b) | a == b) {
@@ -584,11 +586,9 @@ fn dyadic_level(
584
586
FormatShape ( ys_prefix)
585
587
) ) ) ;
586
588
}
587
- xn = xn. min ( xs. rank ( ) ) ;
588
- yn = yn. min ( ys. rank ( ) ) ;
589
589
let xs_row_shape = Shape :: from ( & xs. shape ( ) [ xn..] ) ;
590
590
let ys_row_shape = Shape :: from ( & ys. shape ( ) [ yn..] ) ;
591
- let mut new_rows = Value :: builder ( 1 ) ;
591
+ let mut new_rows = Vec :: new ( ) ;
592
592
if xn == yn {
593
593
for ( x, y) in xs
594
594
. row_shaped_slices ( xs_row_shape)
@@ -598,9 +598,9 @@ fn dyadic_level(
598
598
env. push ( x) ;
599
599
env. call_error_on_break ( f. clone ( ) , "break is not allowed in level" ) ?;
600
600
let row = env. pop ( "level's function result" ) ?;
601
- new_rows. add_row ( row, env ) ? ;
601
+ new_rows. push ( row) ;
602
602
}
603
- let mut new_value = new_rows . finish ( ) ;
603
+ let mut new_value = Value :: from_row_values ( new_rows , env ) ? ;
604
604
let mut new_shape = Shape :: from_iter ( if xs. shape ( ) . len ( ) > ys. shape ( ) . len ( ) {
605
605
xs. shape ( ) [ ..xn] . iter ( ) . copied ( )
606
606
} else {
@@ -617,10 +617,10 @@ fn dyadic_level(
617
617
env. push ( x. clone ( ) ) ;
618
618
env. call_error_on_break ( f. clone ( ) , "break is not allowed in level" ) ?;
619
619
let row = env. pop ( "level's function result" ) ?;
620
- new_rows. add_row ( row, env ) ? ;
620
+ new_rows. push ( row) ;
621
621
}
622
622
}
623
- let mut new_value = new_rows . finish ( ) ;
623
+ let mut new_value = Value :: from_row_values ( new_rows , env ) ? ;
624
624
let mut new_shape =
625
625
Shape :: from_iter ( xs. shape ( ) [ ..xn] . iter ( ) . chain ( & ys. shape ( ) [ ..yn] ) . copied ( ) ) ;
626
626
new_shape. extend_from_slice ( & new_value. shape ( ) [ 1 ..] ) ;
0 commit comments