Fixed overwriteAt, that did not overwrite if first pos in Array is to be changed
This commit is contained in:
parent
a711e0d148
commit
673ac452ea
@ -33,9 +33,7 @@ overwriteAt default pos newVal list =
|
||||
let
|
||||
len = List.length list
|
||||
in
|
||||
if pos == 0 then
|
||||
newVal :: list
|
||||
else if pos > len then
|
||||
if pos > len then
|
||||
list ++
|
||||
(List.repeat (pos-len) default) ++
|
||||
[newVal]
|
||||
@ -51,9 +49,7 @@ overwriteAt_Arr default pos newVal list =
|
||||
let
|
||||
len = Array.length list
|
||||
in
|
||||
if pos == 0 then
|
||||
Array.append (Array.fromList [newVal]) list
|
||||
else if pos > len then
|
||||
if pos > len then
|
||||
Array.append list
|
||||
<| Array.append (Array.repeat (pos-len) default)
|
||||
<| Array.fromList [newVal]
|
||||
|
Loading…
x
Reference in New Issue
Block a user