right-pad
This commit is contained in:
parent
1ae5d8eb46
commit
ed68082ee0
1 changed files with 5 additions and 0 deletions
|
@ -528,3 +528,8 @@ def left_pad (to : Nat) {n : Nat} (with' : α) (xs : SizedArray α n)
|
||||||
exact left_pad' to with' xs hnle
|
exact left_pad' to with' xs hnle
|
||||||
|
|
||||||
#eval left_pad 10 413 (from_list [1,2,3,4,5,6,7])
|
#eval left_pad 10 413 (from_list [1,2,3,4,5,6,7])
|
||||||
|
|
||||||
|
def right_pad (to : Nat) {n : Nat} (with' : α) (xs : SizedArray α n)
|
||||||
|
: SizedArray α (max to n) := xs |> reverse |> left_pad to with' |> reverse
|
||||||
|
|
||||||
|
#eval right_pad 10 413 (from_list [1,2,3,4,5,6,7])
|
||||||
|
|
Loading…
Reference in a new issue