We’ll develop an application for drawing pie charts. The application loads data from a comma-separated value (CSV) file and performs pre-processing in order to calculate the percentage of every item in the data source.
Tag: function
Using functions as values in F#
In my previous post, we discussed about immutable data structure. Now, imagine that we want to write a method similar to SumList but that multiplies the numbers rather than adding them. Making this change looks quite easy: we can copy the SumList method and tinker with it. There are only two changes in the modified method: The first change is that we’re using multiplication instead of addition in the branch that does the recursive call ❷. The second change is that the value returned for an empty list is now 1 instead of 0 ❶. This solution works,…
Nested Function Declarations in F#
Implement a nested function in F#. The function prints squares of the last two arguments using the first argument to format the output