Equivalent Kotlin code to my F# functional code : <p>Can any one help me converting my below <code>F#</code> code into <code>Kotlin</code>:</p>

<pre><code>//namespace SysIO

open System.Collections.Generic  // for Dictionary

printf "Hi, Let's start \n"

let series = [|30;21;29;31;40;48;53;47;37;39;31;29;17;9;20;24;27;35;41;38;
          27;31;27;26;21;13;21;18;33;35;40;36;22;24;21;20;17;14;17;19;
          26;29;40;31;20;24;18;26;17;9;17;21;28;32;46;33;23;28;22;27;
          18;8;17;21;31;34;44;38;31;30;26;32|]

let initialSeasonalComponents (series : int []) slen : IDictionary&lt;int, double&gt;  =
    let nSeasons = float  (series.Length / slen)
    let grouped = 
        series 
            |&gt; Array.map float 
            |&gt; Array.chunkBySize slen
    let seasonAverages = grouped |&gt; Array.map Array.average
    Array.init slen (fun i -&gt; i, (Array.zip grouped seasonAverages 
                                    |&gt; Array.fold (fun s (els, av) -&gt; els.[i] + s - av) 0.)
                                        / nSeasons) |&gt; dict

printfn "Seasons Averageß: \n %A" (initialSeasonalComponents series 12)

let initialTrend (series : int []) (slen : int) : double =
     series |&gt; Array.windowed slen
            |&gt; Array.fold (fun s x -&gt; 
                            (x |&gt; Array.rev |&gt; Array.head) -  (x |&gt; Array.head) + s) 0
            |&gt; float
            |&gt; fun x -&gt; x / (float slen)

printfn "Initial Trend: \n %A" (initialTrend series 12)

let tripleExponentialSmoothing series slen alpha beta gamma nPreds =
    let mutable smooth = 0.
    let mutable trend = 0.
    let seasonals = initialSeasonalComponents series 12 |&gt; Dictionary 
    seq {
        for i in 0..(series.Length+nPreds-1) do
          match i with
          | 0 -&gt;     // initial values        
              smooth &lt;- series |&gt; Array.head |&gt; float
              trend &lt;- initialTrend series slen
              yield series |&gt; Array.head |&gt; float
          | i when i &gt;= series.Length -&gt; // we are forecasting
              let m = i - series.Length + 1
              yield (smooth + float m * trend) + seasonals.[i%slen]
          | _ -&gt; 
              let v = series |&gt; Array.head  |&gt; float
              let lastSmooth = smooth
              smooth &lt;- alpha*(v-seasonals.Item(i%slen)) + (1.-alpha)*(smooth+trend)
              trend &lt;- beta * (smooth-lastSmooth) + (1.-beta)*trend
              seasonals.[i%slen] &lt;- gamma*(v-smooth) + (1.-gamma)*seasonals.[i%slen]
              yield smooth + trend + seasonals.Item(i%slen) }
   // result

let f = tripleExponentialSmoothing series 12 0.716 0.029 0.993 24
printfn "Forecast: \n %A" f
</code></pre>
