I need code which creates boolean list depended on inserted list and count. For example, when the user gives List[0,1,2,3,4,5,6,7,8,9,10] and count=2 then then code makes bool List [true,false,true,false,true,false,true,false,true,false,true]
When count = 3 then it will make bool List [true, false, false, true, false, false, true, false, false, true, false]
If count = 4 then [true, false, false, false, true, false, false, false, true, false] and so on….
I´ve written following code but i think, that this code is wrong, i am new to f# so i need you help. Thanks.
let Group (s1 : List) (c : int) =
let lenght = List.length(s1)
(lenght)
let rec MakeBool (count : int) (boolist : List) =
while lenght > 0 do
if lenght % count = 0 then boolist = true::boolist
if lenght % count <> 0 then boolist = false::boolist
lenght = lenght - 1
MakeBool count boolist
Using high-order function (recommended):
Rolling your own function: