Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using F# language. Complete answer in order to get full credit please. Do not co

ID: 3604157 • Letter: U

Question

Using F# language. Complete answer in order to get full credit please. Do not copy-paste from diferent site. Thank you.

An interesting higher-order function is twice, which can be defined by

or, using F#'s function composition operator <<, by

If we also define

then we can evaluate expressions like

It is pretty easy to see that with k occurrences of twice, these expressions will return 2k.

Remarkably, F# also allows us to evaluate expressions like

in which the function applications are associated to the left, by F#'s default parsing conventions. (Notice that this means that twice gets applied to itself!) Can you figure out a formula that gives the value of

when there are k occurrences of twice? (I suggest that you approach this problem experimentally.)

Explanation / Answer

using System; using System.IO; using System.Collections; using System.Linq; class program { public static void Main(string[] args) { var t = typeof(IEnumerable); var typesIEnum = AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes()).Where(x => t.IsAssignableFrom(x)); foreach (var types in typesIEnum) { Console.WriteLine(types.FullName); } Console.ReadLine(); } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote