f# iterating : The type 'unit' does not match the type 'char'
题
I have this function
let items = ['a'; 'a'; 'a'; 'a'; 'b'; 'b'; 'a'; 'a'; 'c'; 'd'; 'd'; 'e'; 'e';]
open System
let rng = new Random()
let randomSelect list toget = let randomList k len = List.init k (fun _ -> rng.Next(1,len))
let getK l k = List.nth l k
let primeGet = getK list
List.length list
|> randomList toget
|> List.iter (fun i -> primeGet i)
let res23 = randomSelect items 3
but for some reason the function is expecting a unit list, not a generic one
The type 'unit' does not match the type 'char'
why is this happening ?
没有正确的解决方案
不隶属于 StackOverflow