(* ITT8060 -- Advanced Programming 2024 Department of Software Science Tallinn University of Technology ------------------------------------ Coursework 0: Getting started ------------------------------------ Name: Student ID: ------------------------------------ Answer the questions below. You answers to questions 2--8 should be correct F# code written after the question. The F# code for question 1 is written for you and serves as an example. This file is an F# script file, it should be possible to load the whole file at once. If you can't then you have introduced a syntax error somewhere. This coursework will NOT be graded but we encourage you to do it, you will not succeed in this course if you don't practice, and there's no time like the present! Also, you may find that parts of it appear in later courseworks. *) // 0. Find your way to the fsharp interactive (fsi) command prompt. // I.e. log in to a lab machine and start Visual Studio, install // VSCode/Ionide and .net 8.0 on your laptop, etc. // dotnet fsi // 1. Load the following function into fsi let greeting name = printfn "Tere, %s" name // 2. Run the function greeting and say hello to yourself. // 3. Create a value myName : string that contains your name. // 4.Define a function with two arguments with the following type signature // splitAtChar : text:string -> sep:char -> string list // 5. Write a function splitAtSpaces in such a way that it uses splitAtChar // Hint: we defined splitAtSpaces in the lecture, now you need to modify it. // 6. Define sentenceCount : text:string -> int // 7. Define stats : text:string -> unit // which prints the same stats as showWordCount and // the number of sentences and average length of sentences // hint: try float: int -> float // 8. Use the 'http' function from the lecture to download the file // https://ws-export.wmcloud.org/?format=txt&lang=et&page=T%C3%B5de_ja_%C3%B5igus_I as a string // NOTE: you cannot use this function in tryfsharp. Instead you can // paste the text into your file as a string and process it locally // 9. run stats on the downloaded file