(*Please note that audio syncronisation in this video is, to use a technical term, a bit janky. efforts have been made to fix this however none of my own editing softwares will take in the video file*) (*inserts an element at a given position in a list, this gives a warning however it works fine*) fun filipfun 0 x l = x::l | filipfun n x (h::t) = h::(filipfun (n-1) x t); (*inserts hello between the "bye" strings*) filipfun 1 "hello" ["bye","bye"]; (*adds all the elements of a list together using tail recursion*) fun mysum [] = 0 | mysum (h::t) = h+(mysum t); (*adds all the squares of the elements of a list together using tail recursion*) fun mysqr [] = 0 | mysqr (h::t) = h*h+(mysum t); (*gives the factorial of a given integer*) fun myfact 0 = 1 | myfact n = n*(myfact (n-1)); (*traverses a list and appiles a function to all elements of that list *) fun mymap f [] = [] | mymap f (h::t) = (f h)::(mymap f t); (*an example of using the square function with mymap*) mymap (fn x => x*x) [1,2,3,4,5,6,7,8]; (*deconstructs the 'o' operator*) op o; (*(put thing with o operator in here)*) (*float factorial, note that float types cannot be used in pattern matching as it is not a equality types*) fun myfloatfact x = if (x >= 0.0 andalso x <= 0.0) then 1.0 else x*(myfloatfact (x-1.0)); (*Fork bomb, this does not work as a fork bomb. To write a real functioning fork bomb use bash*) fun mybomb x = (myBomb x)*(myBomb x) (*an alternative fork bomb, still doesn't work*) fun mybomb x = (mybomb x)*x;