1
Fork 0

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:
Matei Adriel 2019-12-15 14:55:46 +02:00 committed by prescientmoon
parent 482a5e4370
commit a2243a035b
Signed by: prescientmoon
SSH key fingerprint: SHA256:UUF9JT2s8Xfyv76b8ZuVL7XrmimH4o49p4b+iexbVH4
2 changed files with 8 additions and 0 deletions

View 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)

View file

@ -5,6 +5,7 @@
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="src/Utils.fs" />
<Compile Include="src/Card.fs" />
<Compile Include="src/Board.fs" />
<Compile Include="src/Program.fs" />