fsharp(ygosim): feat: added a basic helper to set an element by index in a list
Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
parent
482a5e4370
commit
a2243a035b
7
fsharp/ygosim/src/Utils.fs
Normal file
7
fsharp/ygosim/src/Utils.fs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
module Utils
|
||||||
|
|
||||||
|
module List =
|
||||||
|
let setIndex index value list =
|
||||||
|
List.mapi (fun previous i ->
|
||||||
|
if i = index then value
|
||||||
|
else previous)
|
|
@ -5,6 +5,7 @@
|
||||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="src/Utils.fs" />
|
||||||
<Compile Include="src/Card.fs" />
|
<Compile Include="src/Card.fs" />
|
||||||
<Compile Include="src/Board.fs" />
|
<Compile Include="src/Board.fs" />
|
||||||
<Compile Include="src/Program.fs" />
|
<Compile Include="src/Program.fs" />
|
||||||
|
|
Loading…
Reference in a new issue