Question: Write a function prefixes: 'a list -> 'a list list prefixes 1 returns a list of all non-empty prefixes of an input list 1,
Write a function prefixes: 'a list -> 'a list list prefixes 1 returns a list of all non-empty prefixes of an input list 1, ordered from shortest to longest. There are no non-empty prefixes of an empty list. let prefixes 1 = (* YOUR CODE HERE *) assert (prefixes [1;2;3;4] = [[]; [1; 2]; [1; 2; 3]; [1;2;3;4]]); assert (prefixes [] = []);
Step by Step Solution
There are 3 Steps involved in it
Sure here is a Python function called prefixes that returns a li... View full answer
Get step-by-step solutions from verified subject matter experts
